Java Reference
In-Depth Information
TableColumn Properties
Table 18-10 lists the 12 properties of the TableColumn . These properties allow you to customize a
column beyond the initial set of constructor arguments. Most of the time, everything is config-
ured for you based on the TableModel . However, you can still customize individual columns
through the TableColumn class. Yes, all the properties are bound, except for the listener list.
Note If an identifier isn't specified, the headerValue setting is used instead.
Table 18-10. TableColumn Properties
Property Name
Data Type
Access
cellEditor
TableCellEditor
Read-write bound
cellRenderer
TableCellRenderer
Read-write bound
headerRenderer
TableCellRenderer
Read-write bound
headerValue
Object
Read-write bound
identifier
Object
Read-write bound
maxWidth
int
Read-write bound
minWidth
int
Read-write bound
modelIndex
int
Read-write bound
preferredWidth
int
Read-write bound
propertyChangeListeners
PropertyChangeListener[ ]
Read-only
resizable
boolean
Read-write bound
width
int
Read-write bound
Caution If headerRenderer is null , the default header renderer is used by the column:
TableCellRenderer headerRenderer = table.getTableHeader().getDefaultRenderer(); .
The default is not returned by the getHeaderRenderer() method.
Using Icons in Column Headers
By default, the header renderer for a table displays text or HTML. Although you can get multiple
lines of text and images with HTML, there may come a time when you want to display regular
Icon objects within a header, as shown in the example in Figure 18-11. To do this, you must
change the header's renderer. The header renderer is just another TableCellRenderer .
 
Search WWH ::




Custom Search