JTable
.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 JavaBeans
has been added to the java.beans
package.
Please see java.
.
JTable
Modifier and Type | Field and Description |
---|---|
protected transient ChangeEvent | changeEvent
Change event (only one needed) |
protected int | columnMargin
Width margin between each column |
protected boolean | columnSelectionAllowed
Column selection allowed in this column model |
protected EventListenerList | listenerList
List of TableColumnModelListener |
protected ListSelectionModel | selectionModel
Model for keeping track of column selections |
protected Vector | tableColumns
Array of TableColumn objects in this model |
protected int | totalColumnWidth
A local cache of the combined width of all columns |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | addColumn(TableColumn
the aColumn)TableColumn to be addedImplements javax. Appends |
public void | addColumnModelListener(TableColumnModelListener
a x)TableColumnModelListener objectImplements javax. Adds a listener for table column model events. |
protected ListSelectionModel | Returns: a newly created default list selection model.Creates a new default list selection model. |
protected void | fireColumnAdded(TableColumnModelEvent
the event received e)Notifies all listeners that have registered interest for notification on this event type. |
protected void | fireColumnMarginChanged()
Notifies all listeners that have registered interest for notification on this event type. |
protected void | fireColumnMoved(TableColumnModelEvent
the event received e)Notifies all listeners that have registered interest for notification on this event type. |
protected void | fireColumnRemoved(TableColumnModelEvent
the event received e)Notifies all listeners that have registered interest for notification on this event type. |
protected void | fireColumnSelectionChanged(ListSelectionEvent
the event received e)Notifies all listeners that have registered interest for notification on this event type. |
public TableColumn | Returns: theTableColumn object for the column
at columnIndex the index of the column desired columnIndex)Implements javax. Returns the |
public int | Returns: the number of columns in thetableColumns arrayImplements javax. Returns the number of columns in the |
public int | Returns: the index of the first column in thetableColumns array whose identifier
is equal to identifier the identifier object identifier)Implements javax. Returns the index of the first column in the |
public int | Returns: the index of the column or -1 if no column is foundthe horizontal location of interest x)Implements javax. Returns the index of the column that lies at position |
public int | Returns: the maximum width for theTableColumn Implements javax. Returns the width margin for |
public TableColumnModelListener[] | Returns: all of this default table column model'sColumnModelListener s
or an empty
array if no column model listeners are currently registeredReturns an array of all the column model listeners registered on this model. |
public Enumeration | Returns: anEnumeration of the columns in the modelImplements javax. Returns an |
public boolean | Returns: thecolumnSelectionAllowed propertyImplements javax. Returns true if column selection is allowed, otherwise false. |
public < the listener type T extends EventListener> T[] | Returns: an array of all objects registered asFooListener s on this model,
or an empty array if no such
listeners have been addedthe type of listeners requested listenerType)Returns an array of all the objects currently registered
as |
public int | Returns: the number of columns selectedImplements javax. Returns the number of columns selected. |
public int[] | Returns: an array of selected columns or an empty array if nothing is selected or theselectionModel is
null Implements javax. Returns an array of selected columns. |
public ListSelectionModel | Returns: the object that provides column selection state. Ornull if row selection is not allowed.Implements javax. Returns the |
public int | Returns: thetotalColumnWidth propertyImplements javax. Returns the total combined width of all columns. |
private void | |
public void | moveColumn(int
the index of column to be moved columnIndex, int new index to move the column newIndex)Implements javax. Moves the column and heading at |
public void | propertyChange(PropertyChangeEvent
PropertyChangeEvent Implements java. Property Change Listener change method. |
protected void | |
public void | removeColumn(TableColumn
the column)TableColumn to be removedImplements javax. Deletes the |
public void | removeColumnModelListener(TableColumnModelListener
a x)TableColumnModelListener objectImplements javax. Removes a listener for table column model events. |
public void | setColumnMargin(int
the new margin width, in pixels newMargin)Implements javax. Sets the column margin to |
public void | setColumnSelectionAllowed(boolean
true if column selection will be allowed, false otherwise flag)Implements javax. Sets whether column selection is allowed. |
public void | setSelectionModel(ListSelectionModel
the new selection model newModel)Implements javax. Sets the selection model for this |
public void | valueChanged(ListSelectionEvent
the change event e)Implements javax. A |
changeEvent | back to summary |
---|---|
protected transient ChangeEvent changeEvent Change event (only one needed) |
columnMargin | back to summary |
---|---|
protected int columnMargin Width margin between each column |
columnSelectionAllowed | back to summary |
---|---|
protected boolean columnSelectionAllowed Column selection allowed in this column model |
listenerList | back to summary |
---|---|
protected EventListenerList listenerList List of TableColumnModelListener |
selectionModel | back to summary |
---|---|
protected ListSelectionModel selectionModel Model for keeping track of column selections |
tableColumns | back to summary |
---|---|
protected Vector<TableColumn> tableColumns Array of TableColumn objects in this model |
totalColumnWidth | back to summary |
---|---|
protected int totalColumnWidth A local cache of the combined width of all columns |
DefaultTableColumnModel | back to summary |
---|---|
public DefaultTableColumnModel() Creates a default table column model. |
addColumn | back to summary |
---|---|
public void addColumn(TableColumn aColumn) Implements javax. Appends
|
addColumnModelListener | back to summary |
---|---|
public void addColumnModelListener(TableColumnModelListener x) Implements javax. Adds a listener for table column model events.
|
createSelectionModel | back to summary |
---|---|
protected ListSelectionModel createSelectionModel() Creates a new default list selection model.
|
fireColumnAdded | back to summary |
---|---|
protected void fireColumnAdded(TableColumnModelEvent e) Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
|
fireColumnMarginChanged | back to summary |
---|---|
protected void fireColumnMarginChanged() Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
|
fireColumnMoved | back to summary |
---|---|
protected void fireColumnMoved(TableColumnModelEvent e) Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
|
fireColumnRemoved | back to summary |
---|---|
protected void fireColumnRemoved(TableColumnModelEvent e) Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
|
fireColumnSelectionChanged | back to summary |
---|---|
protected void fireColumnSelectionChanged(ListSelectionEvent e) Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
|
getColumn | back to summary |
---|---|
public TableColumn getColumn(int columnIndex) Implements javax. Returns the
|
getColumnCount | back to summary |
---|---|
public int getColumnCount() Implements javax. Returns the number of columns in the
|
getColumnIndex | back to summary |
---|---|
public int getColumnIndex(Object identifier) Implements javax. Returns the index of the first column in the
|
getColumnIndexAtX | back to summary |
---|---|
public int getColumnIndexAtX(int x) Implements javax. Returns the index of the column that lies at position
|
getColumnMargin | back to summary |
---|---|
public int getColumnMargin() Implements javax. Returns the width margin for
|
getColumnModelListeners | back to summary |
---|---|
public TableColumnModelListener[] getColumnModelListeners() Returns an array of all the column model listeners registered on this model.
|
getColumns | back to summary |
---|---|
public Enumeration Implements javax. Returns an
|
getColumnSelectionAllowed | back to summary |
---|---|
public boolean getColumnSelectionAllowed() Implements javax. Returns true if column selection is allowed, otherwise false. The default is false.
|
getListeners | back to summary |
---|---|
public <T extends EventListener> T[] getListeners(Class<T> listenerType) Returns an array of all the objects currently registered
as
You can specify the ColumnModelListener[] cmls = (ColumnModelListener[])(m.getListeners(ColumnModelListener.class));If no such listeners exist, this method returns an empty array.
|
getSelectedColumnCount | back to summary |
---|---|
public int getSelectedColumnCount() Implements javax. Returns the number of columns selected.
|
getSelectedColumns | back to summary |
---|---|
public int[] getSelectedColumns() Implements javax. Returns an array of selected columns. If
|
getSelectionModel | back to summary |
---|---|
public ListSelectionModel getSelectionModel() Implements javax. Returns the
|
getTotalColumnWidth | back to summary |
---|---|
public int getTotalColumnWidth() Implements javax. Returns the total combined width of all columns.
|
invalidateWidthCache | back to summary |
---|---|
private void invalidateWidthCache() |
moveColumn | back to summary |
---|---|
public void moveColumn(int columnIndex, int newIndex) Implements javax. Moves the column and heading at
|
propertyChange | back to summary |
---|---|
public void propertyChange(PropertyChangeEvent evt) Implements java. Property Change Listener change method. Used to track changes to the column width or preferred column width.
|
recalcWidthCache | back to summary |
---|---|
protected void recalcWidthCache() Recalculates the total combined width of all columns. Updates the
|
removeColumn | back to summary |
---|---|
public void removeColumn(TableColumn column) Implements javax. Deletes the
|
removeColumnModelListener | back to summary |
---|---|
public void removeColumnModelListener(TableColumnModelListener x) Implements javax. Removes a listener for table column model events.
|
setColumnMargin | back to summary |
---|---|
public void setColumnMargin(int newMargin) Implements javax. Sets the column margin to
|
setColumnSelectionAllowed | back to summary |
---|---|
public void setColumnSelectionAllowed(boolean flag) Implements javax. Sets whether column selection is allowed. The default is false.
|
setSelectionModel | back to summary |
---|---|
public void setSelectionModel(ListSelectionModel newModel) Implements javax. Sets the selection model for this
|
valueChanged | back to summary |
---|---|
public void valueChanged(ListSelectionEvent e) Implements javax. A
|