TableColumn (Java Platform SE 8 ) (original) (raw)

A TableColumn represents all the attributes of a column in aJTable, such as width, resizability, minimum and maximum width. In addition, the TableColumn provides slots for a renderer and an editor that can be used to display and edit the values in this column.

It is also possible to specify renderers and editors on a per type basis rather than a per column basis - see thesetDefaultRenderer method in the JTable class. This default mechanism is only used when the renderer (or editor) in the TableColumn is null.

The TableColumn stores the link between the columns in theJTable and the columns in the TableModel. The modelIndex is the column in theTableModel, which will be queried for the data values for the cells in this column. As the column moves around in the view thismodelIndex does not change.

Note: Some implementations may assume that allTableColumnModels are unique, therefore we would recommend that the same TableColumn instance not be added more than once to a TableColumnModel. To show TableColumns with the same column of data from the model, create a new instance with the samemodelIndex.

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.