javax.swing.table
Class TableColumn
- Serializable
Represents the attributes of a column in a table, including the column index,
width, minimum width, preferred width and maximum width.
TableColumn() - Creates a new
TableColumn that maps to column 0 in the
related table model.
|
TableColumn(int modelIndex) - Creates a new
TableColumn that maps to the specified column
in the related table model.
|
TableColumn(int modelIndex, int width) - Creates a new
TableColumn that maps to the specified column
in the related table model, and has the specified width .
|
TableColumn(int modelIndex, int width, TableCellRenderer cellRenderer, TableCellEditor cellEditor) - Creates a new
TableColumn that maps to the specified column
in the related table model, and has the specified width ,
cellRenderer and cellEditor .
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
COLUMN_WIDTH_PROPERTY
public static final String COLUMN_WIDTH_PROPERTY
The name for the columnWidth
property (this field is
obsolete and no longer used). Note also that the typo in the value
string is deliberate, to match the specification.
isResizable
protected boolean isResizable
A flag that determines whether or not the column is resizable (the default
is true
).
maxWidth
protected int maxWidth
The maximum width for the column.
minWidth
protected int minWidth
The minimum width for the column.
modelIndex
protected int modelIndex
The index of the corresponding column in the table model.
width
protected int width
The current width for the column.
TableColumn
public TableColumn()
Creates a new TableColumn
that maps to column 0 in the
related table model. The default width is 75
units.
TableColumn
public TableColumn(int modelIndex)
Creates a new TableColumn
that maps to the specified column
in the related table model. The default width is 75
units.
modelIndex
- the index of the column in the model
TableColumn
public TableColumn(int modelIndex,
int width)
Creates a new TableColumn
that maps to the specified column
in the related table model, and has the specified width
.
modelIndex
- the index of the column in the modelwidth
- the width
TableColumn
public TableColumn(int modelIndex,
int width,
TableCellRenderer cellRenderer,
TableCellEditor cellEditor)
Creates a new TableColumn
that maps to the specified column
in the related table model, and has the specified width
,
cellRenderer
and cellEditor
.
modelIndex
- the index of the column in the modelwidth
- the widthcellRenderer
- the cell renderer (null
permitted).cellEditor
- the cell editor (null
permitted).
enableResizedPosting
public void enableResizedPosting()
1.3
This method is empty, unused and deprecated.
getCellEditor
public TableCellEditor getCellEditor()
Returns the cell editor for the column (the default value is
null
).
- The cell editor (possibly
null
).
getMaxWidth
public int getMaxWidth()
- The maximum width for the column.
getMinWidth
public int getMinWidth()
Returns the TableColumn
's minimum width (the default value
is 15
).
getModelIndex
public int getModelIndex()
Returns the index of the column in the related
TableModel
that
this
TableColumn
maps to.
getPreferredWidth
public int getPreferredWidth()
Returns the preferred width for the column (the default value is
75
).
getPropertyChangeListeners
public PropertyChangeListener[] getPropertyChangeListeners()
Returns the property change listeners for this TableColumn
.
An empty array is returned if there are currently no listeners registered.
- The property change listeners registered with this column.
getResizable
public boolean getResizable()
Returns the flag that controls whether or not the column is resizable.
true
if this column is resizable,
false
otherwise.
getWidth
public int getWidth()
Returns the width for the column (the default value is 75
).
setCellEditor
public void setCellEditor(TableCellEditor cellEditor)
Sets the cell editor for the column and sends a
PropertyChangeEvent
(with the property name 'cellEditor') to all registered listeners.
cellEditor
- the cell editor (null
permitted).
setHeaderValue
public void setHeaderValue(Object headerValue)
headerValue
- the value of the header (null
permitted).
setIdentifier
public void setIdentifier(Object identifier)
Sets the identifier for the column and sends a
PropertyChangeEvent
(with the property name 'identifier') to all registered listeners.
identifier
- the identifier (null
permitted).
setMaxWidth
public void setMaxWidth(int maxWidth)
Sets the maximum width for the column and sends a
PropertyChangeEvent
(with the property name 'maxWidth') to all
registered listeners. If the current
width
and/or
preferredWidth
are greater than the new maximum width, they
are adjusted accordingly.
maxWidth
- the maximum width.
setMinWidth
public void setMinWidth(int minWidth)
Sets the minimum width for the column and sends a
PropertyChangeEvent
(with the property name 'minWidth') to all
registered listeners. If the current
width
and/or
preferredWidth
are less than the new minimum width, they are
adjusted accordingly.
minWidth
- the minimum width (negative values are treated as 0).
setModelIndex
public void setModelIndex(int modelIndex)
Sets the index of the column in the related
TableModel
that this
TableColumn
maps to, and sends a
PropertyChangeEvent
(with the property name 'modelIndex') to all registered listeners.
modelIndex
- the column index in the model.
setPreferredWidth
public void setPreferredWidth(int preferredWidth)
Sets the preferred width for the column and sends a
PropertyChangeEvent
(with the property name 'preferredWidth') to
all registered listeners. If necessary, the supplied value will be
adjusted to fit in the range
getMinWidth()
to
getMaxWidth()
.
preferredWidth
- the preferred width.
setResizable
public void setResizable(boolean isResizable)
Sets the flag that controls whether or not the column is resizable, and
sends a
PropertyChangeEvent
(with the property name 'isResizable')
to all registered listeners.
isResizable
- true
if this column is resizable,
false
otherwise.
setWidth
public void setWidth(int newWidth)
Sets the width for the column and sends a
PropertyChangeEvent
(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.
sizeWidthToFit
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.
TableColumn.java --
Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.