We’ve seen the
TableColumnModel which stores a lot of information
about the structure of a table, but doesn’t contain the actual
data. The data that’s displayed in a
is stored in a
TableModel interface describes the minimum
requirements for a model that supplies the information necessary to
display and edit a table’s cells, and to show column headers.
AbstractTableModel fills out most of the
TableModel interface, but leaves the methods for
retrieving the actual data undefined. The
AbstractTableModel and provides an implementation
for storing data as a vector of vectors. We’ll be looking at
both the abstract and default table models in more detail later in
The TableModel Interface
All of the table models start with
this interface. A table model must be able to give out information on
the number of rows and columns in the table and have access to the
values of the cells of the table. The
interface also has methods that can be used to encode information
about the columns of the table (such as a localized name or class
type), apart from the column model.
TableModel interface supports the properties
shown in Table 15.5. The
is the number of columns in the
data model. This does not have to match the number of columns
reported by the column model. Likewise,
is the number of rows in the data model.
columnClass are indexed properties that let you ...