|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.java.swing.table.TableColumn
The TableColumn stores the link between the columns in the JTable and the columns in the TableModel. This, 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.
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. This default mechanism is only used when the renderer (or editor) in the TableColumn is null.
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 Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.
TableColumnModel
,
DefaultTableColumnModel
, Serialized FormField Summary | |
static String | CELL_RENDERER_PROPERTY
Bound property name. |
protected TableCellEditor | cellEditor
The editor used to edit the data cells of the column |
protected TableCellRenderer | cellRenderer
The renderer used to draw the data cells of the column |
static String | COLUMN_WIDTH_PROPERTY
Bound property name. |
static String | HEADER_RENDERER_PROPERTY
Bound property name. |
static String | HEADER_VALUE_PROPERTY
Bound property name. |
protected TableCellRenderer | headerRenderer
The renderer used to draw the header of the column |
protected Object | headerValue
The header value of the column |
protected Object | identifier
This object is not used internally by the drawing machinery of the JTable. |
protected boolean | isResizable
Resizable flag |
protected int | maxWidth
The maximum width of the column |
protected int | minWidth
The minimum width of the column |
protected int | modelIndex
The index of the column in the model which is to be displayed by this TableColumn. |
protected int | resizedPostingDisableCount
Counter used to disable posting of resizing notifications until the end of the resize |
protected int | width
The width of the column |
Constructor Summary | |
TableColumn()
Creates an empty TableColumn. |
|
TableColumn(int modelIndex,
int width,
TableCellRenderer cellRenderer,
TableCellEditor cellEditor)
|
|
TableColumn(int modelIndex,
int width)
|
|
TableColumn(int modelIndex)
Creates and initializes an instance of TableColumn with modelIndex. |
Method Summary | |
void | addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
protected TableCellRenderer | createDefaultHeaderRenderer()
|
void | disableResizedPosting()
|
void | enableResizedPosting()
|
TableCellEditor | getCellEditor()
Returns the TableCellEditor used by the JTable to draw values for this column. |
TableCellRenderer | getCellRenderer()
Returns the TableCellRenderer used by the JTable to draw values for this column. |
TableCellRenderer | getHeaderRenderer()
Returns the TableCellRenderer used to draw the header of the TableColumn. |
Object | getHeaderValue()
Returns the Object used as the value for the header renderer. |
Object | getIdentifier()
Returns the identifier object for this column. |
int | getMaxWidth()
Returns the maximum width for the TableColumn. |
int | getMinWidth()
Returns the minimum width for the TableColumn. |
int | getModelIndex()
Gets the model index for this column. |
boolean | getResizable()
Returns true if the user is allowed to resize the TableColumn width, false otherwise. |
int | getWidth()
Returns the width of the TableColumn. |
void | removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
void | setCellEditor(TableCellEditor anEditor)
Sets the TableCellEditor used by JTable to draw individual values for this column to anEditor. |
void | setCellRenderer(TableCellRenderer aRenderer)
Sets the TableCellRenderer used by JTable to draw individual values for this column to aRenderer. |
void | setHeaderRenderer(TableCellRenderer aRenderer)
Sets the TableCellRenderer used to draw the TableColumn's header to aRenderer. |
void | setHeaderValue(Object aValue)
Sets the Object used as the value for the headerRenderer Posts a bound property change notification with the name HEADER_VALUE_PROPERTY. |
void | setIdentifier(Object anIdentifier)
Sets the TableColumn's identifier to anIdentifier. |
void | setMaxWidth(int newMaxWidth)
Sets the TableColumn's maximum width to newMaxWidth, also adjusting the current width if it's greater than this value. |
void | setMinWidth(int newMinWidth)
Sets the TableColumn's minimum width to newMinWidth, also adjusting the current width if it's less than this value. |
void | setModelIndex(int anIndex)
Sets the model index for this column. |
void | setResizable(boolean flag)
Sets whether the user can resize the receiver in its JTableView. |
void | setWidth(int newWidth)
Sets this column's width to newWidth. |
void | sizeWidthToFit()
Resizes the TableColumn to fit the width of its header cell. |
Methods inherited from class java.lang.Object | |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
Field Detail |
public static final String COLUMN_WIDTH_PROPERTY
public static final String HEADER_VALUE_PROPERTY
public static final String HEADER_RENDERER_PROPERTY
public static final String CELL_RENDERER_PROPERTY
protected int modelIndex
protected Object identifier
protected int width
protected int minWidth
protected int maxWidth
protected TableCellRenderer headerRenderer
protected Object headerValue
protected TableCellRenderer cellRenderer
protected TableCellEditor cellEditor
protected boolean isResizable
protected transient int resizedPostingDisableCount
Constructor Detail |
public TableColumn()
public TableColumn(int modelIndex)
modelIndex
- the column in the model which provides the values for this column#setHeaderValue()
public TableColumn(int modelIndex, int width)
public TableColumn(int modelIndex, int width, TableCellRenderer cellRenderer, TableCellEditor cellEditor)
Method Detail |
public void setModelIndex(int anIndex)
public int getModelIndex()
public void setIdentifier(Object anIdentifier)
anIdentifier
- an identifier for this columngetIdentifier()
public Object getIdentifier()
getHeaderValue()
as a default.#setIdentifier()
public void setHeaderRenderer(TableCellRenderer aRenderer)
aRenderer
- the new header renderergetHeaderRenderer()
public TableCellRenderer getHeaderRenderer()
#setHeaderRenderer()
,
#setHeaderValue()
public void setHeaderValue(Object aValue)
aValue
- the new header valuegetHeaderValue()
public Object getHeaderValue()
#setHeaderValue()
public void setCellRenderer(TableCellRenderer aRenderer)
aRenderer
- the new data cell renderergetCellRenderer()
public TableCellRenderer getCellRenderer()
#setCellRenderer()
public void setCellEditor(TableCellEditor anEditor)
anEditor
- the new data cell editorgetCellEditor()
public TableCellEditor getCellEditor()
#setCellEditor()
public void setWidth(int newWidth)
Note: The default resize mode of the JTable is AUTO_RESIZE_ALL_COLUMNS, which causes the JTable to control the widths of the columns itself and so override any widths set by an application using this method. To control the widths of the columns progammatically, be sure to first call setAutoResizeMode(AUTO_RESIZE_OFF) on the JTable.
newWidth
- The new width valuegetWidth()
,
getMinWidth()
,
#setMinWidth()
,
getMaxWidth()
,
#setMaxWidth()
public int getWidth()
#setWidth()
,
getMinWidth()
,
#setMinWidth()
,
getMaxWidth()
,
#setMaxWidth()
public void setMinWidth(int newMinWidth)
newMinWidth
- the new minimum width valuegetWidth()
,
#setWidth()
,
getMinWidth()
,
getMaxWidth()
,
#setMaxWidth()
public int getMinWidth()
getWidth()
,
#setWidth()
,
#setMinWidth()
,
getMaxWidth()
,
#setMaxWidth()
public void setMaxWidth(int newMaxWidth)
newMaxWidth
- the new maximum width valuegetWidth()
,
#setWidth()
,
getMinWidth()
,
#setMinWidth()
,
getMaxWidth()
public int getMaxWidth()
getWidth()
,
#setWidth()
,
getMinWidth()
,
#setMinWidth()
,
#setMaxWidth()
public void setResizable(boolean flag)
flag
- true if the column isResizablegetResizable()
public boolean getResizable()
#setResizable()
public void sizeWidthToFit()
#setWidth()
,
#setMinWidth()
,
#setMaxWidth()
public void disableResizedPosting()
public void enableResizedPosting()
public void addPropertyChangeListener(PropertyChangeListener listener)
A PropertyChangeEvent will get fired in response to an explicit setFont, setBackground, or SetForeground on the current component. Note that if the current component is inheriting its foreground, background, or font from its container, then no event will be fired in response to a change in the inherited property.
listener
- The PropertyChangeListener to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
listener
- The PropertyChangeListener to be removedprotected TableCellRenderer createDefaultHeaderRenderer()
|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |