Class AbstractTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
- All Implemented Interfaces:
Serializable
,TableModel
- Direct Known Subclasses:
DefaultTableModel
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 allTableModelListeners
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.Class
<?> getColumnClass
(int columnIndex) ReturnsObject.class
regardless ofcolumnIndex
.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 asFooListener
s upon thisAbstractTableModel
.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.