Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.swing.table.TableColumn
Field Summary | |
static String |
|
static String |
|
static String |
|
static String |
|
protected TableCellEditor |
|
protected TableCellRenderer |
|
protected TableCellRenderer |
|
protected Object |
|
protected Object |
|
protected boolean |
|
protected int |
|
protected int |
|
protected int |
|
protected int |
|
protected int |
|
Constructor Summary | |
| |
| |
| |
|
Method Summary | |
void |
|
protected TableCellRenderer |
|
void |
|
void |
|
TableCellEditor |
|
TableCellRenderer |
|
TableCellRenderer |
|
Object |
|
Object |
|
int |
|
int |
|
int |
|
int |
|
PropertyChangeListener[] |
|
boolean |
|
int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static final String CELL_RENDERER_PROPERTY
The name for thecellRenderer
property.
- Field Value:
- "cellRenderer"
public static final String COLUMN_WIDTH_PROPERTY
The name for thecolumnWidth
property (this field is obsolete and no longer used). Note also that the typo in the value string is deliberate, to match the specification.
- Field Value:
- "columWidth"
public static final String HEADER_RENDERER_PROPERTY
The name for theheaderRenderer
property.
- Field Value:
- "headerRenderer"
public static final String HEADER_VALUE_PROPERTY
The name for theheaderValue
property.
- Field Value:
- "headerValue"
protected TableCellRenderer cellRenderer
The renderer for the regular cells in this column.
protected boolean isResizable
A flag that determines whether or not the column is resizable (the default istrue
).
protected int resizedPostingDisableCount
Deprecated. 1.3
resizedPostingDisableCount
public TableColumn()
Creates a newTableColumn
that maps to column 0 in the related table model. The default width is75
units.
public TableColumn(int modelIndex)
Creates a newTableColumn
that maps to the specified column in the related table model. The default width is75
units.
- Parameters:
modelIndex
- the index of the column in the model
public TableColumn(int modelIndex, int width)
Creates a newTableColumn
that maps to the specified column in the related table model, and has the specifiedwidth
.
- Parameters:
modelIndex
- the index of the column in the modelwidth
- the width
public TableColumn(int modelIndex, int width, TableCellRenderer cellRenderer, TableCellEditor cellEditor)
Creates a newTableColumn
that maps to the specified column in the related table model, and has the specifiedwidth
,cellRenderer
andcellEditor
.
- Parameters:
modelIndex
- the index of the column in the modelwidth
- the widthcellRenderer
- the cell renderer (null
permitted).cellEditor
- the cell editor (null
permitted).
public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener so that it receivesPropertyChangeEvent
notifications from this column. The properties defined by the column are:
width
- seesetWidth(int)
;preferredWidth
- seesetPreferredWidth(int)
;minWidth
- seesetMinWidth(int)
;maxWidth
- seesetMaxWidth(int)
;modelIndex
- seesetModelIndex(int)
;isResizable
- seesetResizable(boolean)
;cellRenderer
- seesetCellRenderer(TableCellRenderer)
;cellEditor
- seesetCellEditor(TableCellEditor)
;headerRenderer
- seesetHeaderRenderer(TableCellRenderer)
;headerValue
- seesetHeaderValue(Object)
;identifier
- seesetIdentifier(Object)
.
- Parameters:
listener
- the listener to add (null
is ignored).
protected TableCellRenderer createDefaultHeaderRenderer()
Creates and returns a default renderer for the column header (in this case, a new instance ofDefaultTableCellRenderer
).
- Returns:
- A default renderer for the column header.
public void disableResizedPosting()
Deprecated. 1.3
This method is empty, unused and deprecated.
public void enableResizedPosting()
Deprecated. 1.3
This method is empty, unused and deprecated.
public TableCellEditor getCellEditor()
Returns the cell editor for the column (the default value isnull
).
- Returns:
- The cell editor (possibly
null
).
- See Also:
setCellEditor(TableCellEditor)
public TableCellRenderer getCellRenderer()
Returns the renderer for the table cells in this column.
- Returns:
- The cell renderer (possibly
null
).
- See Also:
setCellRenderer(TableCellRenderer)
public TableCellRenderer getHeaderRenderer()
Returns the renderer for the column header.
- Returns:
- The renderer for the column header (possibly
null
).
- See Also:
setHeaderRenderer(TableCellRenderer)
public Object getHeaderValue()
Returns the header value.
- Returns:
- the value of the header.
- See Also:
getHeaderValue()
public Object getIdentifier()
Returns the identifier for the column, orgetHeaderValue()
if the identifier isnull
.
- Returns:
- The identifier (or
getHeaderValue()
if the identifier isnull
).
public int getMaxWidth()
Returns the maximum width for the column (the default value isInteger.MAX_VALUE
).
- Returns:
- The maximum width for the column.
- See Also:
setMaxWidth(int)
public int getMinWidth()
Returns theTableColumn
's minimum width (the default value is15
).
- Returns:
- The minimum width.
- See Also:
setMinWidth(int)
public int getModelIndex()
Returns the index of the column in the relatedTableModel
that thisTableColumn
maps to.
- Returns:
- the model index.
- See Also:
setModelIndex(int)
public int getPreferredWidth()
Returns the preferred width for the column (the default value is75
).
- Returns:
- The preferred width.
- See Also:
setPreferredWidth(int)
public PropertyChangeListener[] getPropertyChangeListeners()
Returns the property change listeners for thisTableColumn
. An empty array is returned if there are currently no listeners registered.
- Returns:
- The property change listeners registered with this column.
- Since:
- 1.4
public boolean getResizable()
Returns the flag that controls whether or not the column is resizable.
- Returns:
true
if this column is resizable,false
otherwise.
- See Also:
setResizable(boolean)
public int getWidth()
Returns the width for the column (the default value is75
).
- Returns:
- The width.
- See Also:
setWidth(int)
public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener so that it no longer receivesPropertyChangeEvent
notifications from this column. Iflistener
is not registered with the column, or isnull
, this method does nothing.
- Parameters:
listener
- the listener to remove (null
is ignored).
public void setCellEditor(TableCellEditor cellEditor)
Sets the cell editor for the column and sends aPropertyChangeEvent
(with the property name 'cellEditor') to all registered listeners.
- Parameters:
cellEditor
- the cell editor (null
permitted).
- See Also:
getCellEditor()
public void setCellRenderer(TableCellRenderer renderer)
Sets the renderer for cells in this column and sends aPropertyChangeEvent
(with the property nameCELL_RENDERER_PROPERTY
) to all registered listeners.
- Parameters:
renderer
- the cell renderer (null
permitted).
- See Also:
getCellRenderer()
public void setHeaderRenderer(TableCellRenderer renderer)
Sets the renderer for the column header and sends aPropertyChangeEvent
(with the property nameHEADER_RENDERER_PROPERTY
) to all registered listeners.
- Parameters:
renderer
- the header renderer (null
permitted).
- See Also:
getHeaderRenderer()
public void setHeaderValue(Object headerValue)
Sets the header value and sends aPropertyChangeEvent
(with the property nameHEADER_VALUE_PROPERTY
) to all registered listeners.
- Parameters:
headerValue
- the value of the header (null
permitted).
- See Also:
getHeaderValue()
public void setIdentifier(Object identifier)
Sets the identifier for the column and sends aPropertyChangeEvent
(with the property name 'identifier') to all registered listeners.
- Parameters:
identifier
- the identifier (null
permitted).
- See Also:
getIdentifier()
public void setMaxWidth(int maxWidth)
Sets the maximum width for the column and sends aPropertyChangeEvent
(with the property name 'maxWidth') to all registered listeners. If the currentwidth
and/orpreferredWidth
are greater than the new maximum width, they are adjusted accordingly.
- Parameters:
maxWidth
- the maximum width.
- See Also:
getMaxWidth()
public void setMinWidth(int minWidth)
Sets the minimum width for the column and sends aPropertyChangeEvent
(with the property name 'minWidth') to all registered listeners. If the currentwidth
and/orpreferredWidth
are less than the new minimum width, they are adjusted accordingly.
- Parameters:
minWidth
- the minimum width (negative values are treated as 0).
- See Also:
getMinWidth()
public void setModelIndex(int modelIndex)
Sets the index of the column in the relatedTableModel
that thisTableColumn
maps to, and sends aPropertyChangeEvent
(with the property name 'modelIndex') to all registered listeners.
- Parameters:
modelIndex
- the column index in the model.
- See Also:
getModelIndex()
public void setPreferredWidth(int preferredWidth)
Sets the preferred width for the column and sends aPropertyChangeEvent
(with the property name 'preferredWidth') to all registered listeners. If necessary, the supplied value will be adjusted to fit in the rangegetMinWidth()
togetMaxWidth()
.
- Parameters:
preferredWidth
- the preferred width.
- See Also:
getPreferredWidth()
public void setResizable(boolean isResizable)
Sets the flag that controls whether or not the column is resizable, and sends aPropertyChangeEvent
(with the property name 'isResizable') to all registered listeners.
- Parameters:
isResizable
-true
if this column is resizable,false
otherwise.
- See Also:
getResizable()
public void setWidth(int newWidth)
Sets the width for the column and sends aPropertyChangeEvent
(with the property name 'width') to all registered listeners. If the new width falls outside the range getMinWidth() to getMaxWidth() it is adjusted to the appropriate boundary value.
- Parameters:
newWidth
- the width.
- See Also:
getWidth()
public void sizeWidthToFit()
Sets the minimum, maximum, preferred and current width to match the minimum, maximum and preferred width of the header renderer component. If there is no header renderer component, this method does nothing.