class org.aswing.table.TableColumn extends EventDispatcher
A 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
TableColumnModel
s are unique, therefore we would
recommend that the same TableColumn
instance
not be added more than once to a TableColumnModel
.
To show TableColumn
s with the same column of
data from the model, create a new instance with the same
modelIndex
.
![]() | Show Events | Hide Events
|
Class Fields
Instance Fields
![]() | Show inherited public instance fields | Hide inherited public instance fields
|
function new(?modelIndex:Int = 0, ?width:Int = 75, ?cellRenderer:TableCellFactory = null, ?cellEditor:TableCellEditor = null): Void
Create a TableColumn.
modelIndex | modelIndex |
width | the (optional)width of the column, default to 75 |
cellRenderer | (optional)the cell renderer for this column cells |
cellEditor | (optional)the cell editor for this column cells |
function addPropertyChangeListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void
Adds a property change listener.
listener | the listener |
priority | the priority |
useWeakReference | Determines whether the reference to the listener is strong or weak. |
See Also
- org.aswing.event.PropertyChangeEvent.PROPERTY_CHANGE
function removePropertyChangeListener(listener:Dynamic ->Void): Void
Removes a property change listener.
listener | the listener to be removed. |
function sizeWidthToFit(): Void
Resizes the 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.
See Also
- this.setPreferredWidth()