javax.swing.table
public interface TableColumnModel
JTable
to access the columns in the table
view.Modifier and Type | Method and Description |
---|---|
void |
addColumn(TableColumn column)
Adds a column to the model.
|
void |
addColumnModelListener(TableColumnModelListener listener)
Registers a listener with the model, so that it will receive
TableColumnModelEvent notifications. |
TableColumn |
getColumn(int columnIndex)
Returns the
TableColumn at the specified index. |
int |
getColumnCount()
Returns the number of columns in the model.
|
int |
getColumnIndex(Object identifier)
Returns the index of the
TableColumn with the given identifier. |
int |
getColumnIndexAtX(int xPosition)
Returns the index of the column that contains the specified x-coordinate,
assuming that:
column zero begins at position zero;
all columns appear in order;
individual column widths are taken into account, but the column margin
is ignored.
|
int |
getColumnMargin()
Returns the column margin.
|
Enumeration<TableColumn> |
getColumns()
Returns an enumeration of the columns in the model.
|
boolean |
getColumnSelectionAllowed()
Returns
true if column selection is allowed, and
false if column selection is not allowed. |
int |
getSelectedColumnCount()
Returns the number of selected columns in the model.
|
int[] |
getSelectedColumns()
getSelectedColumns
|
ListSelectionModel |
getSelectionModel()
Returns the selection model used to track table column selections.
|
int |
getTotalColumnWidth()
Returns total width of all the columns in the model, ignoring the
column margin (see
getColumnMargin() ). |
void |
moveColumn(int columnIndex,
int newIndex)
Moves a column.
|
void |
removeColumn(TableColumn column)
Removes a column from the model.
|
void |
removeColumnModelListener(TableColumnModelListener listener)
Deregisters a listener, so that it will no longer receive
TableColumnModelEvent notifications. |
void |
setColumnMargin(int margin)
Sets the column margin and sends a
ChangeEvent to all registered
TableColumnModelListener s registered with the model. |
void |
setColumnSelectionAllowed(boolean allowed)
Sets the flag that indicates whether or not column selection is allowed.
|
void |
setSelectionModel(ListSelectionModel model)
Sets the selection model that will be used to keep track of the selected
columns.
|
void addColumn(TableColumn column)
column
- the new column (null
not permitted).IllegalArgumentException
- if column
is
null
.void removeColumn(TableColumn column)
column
is not defined
in the model, this method does nothing.column
- TableColumnvoid moveColumn(int columnIndex, int newIndex)
columnIndex
- Index of column to movenewIndex
- New index of columnvoid setColumnMargin(int margin)
ChangeEvent
to all registered
TableColumnModelListener
s registered with the model.margin
- the column margin.getColumnMargin()
int getColumnCount()
Enumeration<TableColumn> getColumns()
int getColumnIndex(Object identifier)
TableColumn
with the given identifier.identifier
- the identifier (null
not permitted).TableColumn
with the given identifier.IllegalArgumentException
- if identifier
is
null
or there is no column with that identifier.TableColumn getColumn(int columnIndex)
TableColumn
at the specified index.columnIndex
- the column index.int getColumnMargin()
setColumnMargin(int)
int getColumnIndexAtX(int xPosition)
-1
.xPosition
- the x-position.-1
.int getTotalColumnWidth()
getColumnMargin()
).void setColumnSelectionAllowed(boolean allowed)
allowed
- the new flag value.getColumnSelectionAllowed()
boolean getColumnSelectionAllowed()
true
if column selection is allowed, and
false
if column selection is not allowed.setColumnSelectionAllowed(boolean)
int[] getSelectedColumns()
int getSelectedColumnCount()
getSelectionModel()
void setSelectionModel(ListSelectionModel model)
model
- the selection model (null
not permitted).IllegalArgumentException
- if model
is
null
.ListSelectionModel getSelectionModel()
setSelectionModel(ListSelectionModel)
void addColumnModelListener(TableColumnModelListener listener)
TableColumnModelEvent
notifications.listener
- the listener (null
ignored).void removeColumnModelListener(TableColumnModelListener listener)
TableColumnModelEvent
notifications.listener
- the listener.