
CHAPTER 29
Thejavax.swing.table Package
The javax.swing .table package contains classes and interfaces that are used with the
power ful JTable component of the javax.swing package. TableModel is the central inter-
face in this package; it provides access to the data to be displayed in the table.
TableColumn repr esents the attributes of a column in the table. TableColumnModel rep-
resents a set of columns in the table. JTableHeader is a component that displays the
resizable and draggable column headers of a table. The TableCellRenderer inter face
defines how individual cells are drawn using a GUI component as a template. Fig-
ur e 29-1 shows the class hierarchy of this package. See Chapter 3, Swing Program-
ming Topics, for a discussion of and example using JTable and the javax.swing .table
package.
AbstractTableModel Ja va 1.2
javax.swing .table serializable model
This abstract class is a convenient partial implementation of the TableModel inter face. An
application that needs a noneditable TableModel needs only to provide implementations
for the abstract methods getColumnCount(), getRowCount(), and getValueAt().Anapplication
that wants to allow the table data to be edited must additionally override the default
implementations of isCellEditable() and setValueAt(). AbstractTableModel pr ovides default
implementations of the event listener registration methods. Additionally, it defines a
number of methods ...