java.lang.Objectjavax.swing.table.TableColumn
All Implemented Interfaces:
Serializable
TableColumn represents all the attributes of a column in a
JTable, such as width, resizibility, 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 the
setDefaultRenderer 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 the
JTable and the columns in the TableModel.
The modelIndex is the column in the
TableModel, which will be queried for the data values for the
cells in this column. As the column moves around in the view this
modelIndex does not change.
Note: Some implementations may assume that all
TableColumnModels 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 same
modelIndex.
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 JavaBeansTM
has been added to the java.beans package.
Please see java.beans.XMLEncoder .
Alan - ChungPhilip - Milne| Field Summary | ||
|---|---|---|
| public static final String | COLUMN_WIDTH_PROPERTY | Obsolete as of Java 2 platform v1.3. Please use string literals to identify properties. |
| public static final String | HEADER_VALUE_PROPERTY | Obsolete as of Java 2 platform v1.3. Please use string literals to identify properties. |
| public static final String | HEADER_RENDERER_PROPERTY | Obsolete as of Java 2 platform v1.3. Please use string literals to identify properties. |
| public static final String | CELL_RENDERER_PROPERTY | Obsolete as of Java 2 platform v1.3. Please use string literals to identify properties. |
| protected int | modelIndex | The index of the column in the model which is to be displayed by
this TableColumn. As columns are moved around in the
view modelIndex remains constant. |
| protected Object | identifier | This object is not used internally by the drawing machinery of
the JTable; identifiers may be set in the
TableColumn as as an
optional way to tag and locate table columns. The table package does
not modify or invoke any methods in these identifier objects other
than the equals method which is used in the
getColumnIndex() method in the
DefaultTableColumnModel. |
| protected int | width | The width of the column. |
| protected int | minWidth | The minimum width of the column. |
| protected int | maxWidth | The maximum width of the column. |
| protected TableCellRenderer | headerRenderer | The renderer used to draw the header of the column. |
| protected Object | headerValue | The header value of the column. |
| protected TableCellRenderer | cellRenderer | The renderer used to draw the data cells of the column. |
| protected TableCellEditor | cellEditor | The editor used to edit the data cells of the column. |
| protected boolean | isResizable | If true, the user is allowed to resize the column; the default is true. |
| protected transient int | resizedPostingDisableCount | This field was not used in previous releases and there are
currently no plans to support it in the future. |
| Constructor: |
|---|
null renderer and a
null editor.
This method is intended for serialization. |
null
renderer and a null editor. |
null renderer and a
null editor. |
TableColumn with the specified model index,
width, cell renderer, and cell editor;
all TableColumn constructors delegate to this one.
The value of width is used
for both the initial and preferred width;
if width is negative,
they're set to 0.
The minimum width is set to 15 unless the initial width is less,
in which case the minimum width is set to
the initial width.
When the
|
| Methods from java.lang.Object: |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from javax.swing.table.TableColumn Detail: |
|---|
PropertyChangeListener to the listener list.
The listener is registered for all properties.
A |
TableColumn
constructor. Previously this method was used by the
TableColumn to create a default header renderer.
As of Java 2 platform v1.3, the default header renderer is null.
JTableHeader now provides its own shared default
renderer, just as the JTable does for its cell renderers. |
Deprecated! as - of Java 2 platform v1.3
|
Deprecated! as - of Java 2 platform v1.3
|
TableCellEditor used by the
JTable to edit values for this column. When the
cellEditor is null, the JTable
uses a default editor based on the
class of the cells in that column. The default value for a
cellEditor is null. |
TableCellRenderer used by the
JTable to draw
values for this column. The cellRenderer of the column
not only controls the visual look for the column, but is also used to
interpret the value object supplied by the TableModel.
When the cellRenderer is null,
the JTable uses a default renderer based on the
class of the cells in that column. The default value for a
cellRenderer is null. |
TableCellRenderer used to draw the header of the
TableColumn. When the headerRenderer is
null, the JTableHeader
uses its defaultRenderer. The default value for a
headerRenderer is null. |
Object used as the value for the header
renderer. |
identifier object for this column.
Note identifiers are not used by JTable,
they are purely a convenience for external use.
If the identifier is null,
getIdentifier() returns getHeaderValue
as a default. |
TableColumn. The
TableColumn's width can't be made larger than this
either by the user or programmatically. The default maxWidth
is Integer.MAX_VALUE. |
TableColumn. The
TableColumn's width can't be made less than this either
by the user or programmatically. |
|
TableColumn.
The default preferred width is 75. |
PropertyChangeListeners added
to this TableColumn with addPropertyChangeListener(). |
TableColumn's
width, false otherwise. You can change the width programmatically
regardless of this setting. The default is true. |
TableColumn. The default width is
75. |
PropertyChangeListener from the listener list.
The PropertyChangeListener to be removed was registered
for all properties. |
|
TableCellRenderer used by JTable
to draw individual values for this column. |
TableCellRenderer used to draw the
TableColumn's header to headerRenderer.
It is the header renderers responsibility to render the sorting indicator. If you are using sorting and specify a renderer your renderer must render the sorting indication. |
Object whose string representation will be
used as the value for the headerRenderer. When the
TableColumn is created, the default headerValue
is null. |
TableColumn's identifier to
anIdentifier.
Note: identifiers are not used by the |
TableColumn's maximum width to
maxWidth or,
if maxWidth is less than the minimum width,
to the minimum width.
If the value of the
|
TableColumn's minimum width to
minWidth,
adjusting the new minimum width if necessary to ensure that
0 <= minWidth <= maxWidth.
For example, if the minWidth argument is negative,
this method sets the minWidth property to 0.
If the value of the
|
TableColumn. As the TableColumn
is moved around in the view the model index remains constant. |
preferredWidth.
If preferredWidth exceeds the minimum or maximum width,
it is adjusted to the appropriate limiting value.
For details on how the widths of columns in the |
|
JTable, use setPreferredWidth instead.
Like a layout manager in the
AWT, the JTable adjusts a column's width automatically
whenever the
table itself changes size, or a column's preferred width is changed.
Setting widths programmatically therefore has no long term effect.
This method sets this column's width to |
TableColumn to fit the width of its header cell.
This method does nothing if the header renderer is null
(the default case). Otherwise, it sets the minimum, maximum and preferred
widths of this column to the widths of the minimum, maximum and preferred
sizes of the Component delivered by the header renderer.
The transient "width" property of this TableColumn is also set to the
preferred width. Note this method is not used internally by the table
package. |