Class AbstractTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
All Implemented Interfaces:
Serializable, TableModel
Direct Known Subclasses:
DefaultTableModel

public abstract class AbstractTableModel extends Object implements TableModel, Serializable
This abstract class provides default implementations for most of the methods in the TableModel interface. It takes care of the management of listeners and provides some conveniences for generating TableModelEvents and dispatching them to the listeners. To create a concrete TableModel as a subclass of AbstractTableModel you need only provide implementations for the following three methods:
  public int getRowCount();
  public int getColumnCount();
  public Object getValueAt(int row, int column);
  

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see XMLEncoder.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    List of listeners
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor for subclasses to call.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a listener to the list that's notified each time a change to the data model occurs.
    int
    findColumn(String columnName)
    Returns a column given its name.
    void
    fireTableCellUpdated(int row, int column)
    Notifies all listeners that the value of the cell at [row, column] has been updated.
    void
    Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.
    void
    Notifies all listeners that all cell values in the table's rows may have changed.
    void
    fireTableRowsDeleted(int firstRow, int lastRow)
    Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been deleted.
    void
    fireTableRowsInserted(int firstRow, int lastRow)
    Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been inserted.
    void
    fireTableRowsUpdated(int firstRow, int lastRow)
    Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been updated.
    void
    Notifies all listeners that the table's structure has changed.
    getColumnClass(int columnIndex)
    Returns Object.class regardless of columnIndex.
    getColumnName(int column)
    Returns a default name for the column using spreadsheet conventions: A, B, C, ...
    <T extends EventListener>
    T[]
    getListeners(Class<T> listenerType)
    Returns an array of all the objects currently registered as FooListeners upon this AbstractTableModel.
    Returns an array of all the table model listeners registered on this model.
    boolean
    isCellEditable(int rowIndex, int columnIndex)
    Returns false.
    void
    Removes a listener from the list that's notified each time a change to the data model occurs.
    void
    setValueAt(Object aValue, int rowIndex, int columnIndex)
    This empty implementation is provided so users don't have to implement this method if their data model is not editable.

    Methods declared in class java.lang.