public interface TableColumnModel
JTable 。
DefaultTableColumnModel
| Modifier and Type | Method and Description |
|---|---|
void |
addColumn(TableColumn aColumn)
追加
aColumn到
tableColumns数组的末尾。
|
void |
addColumnModelListener(TableColumnModelListener x)
为表格列模型事件添加一个侦听器。
|
TableColumn |
getColumn(int columnIndex)
返回
TableColumn在列对象
columnIndex 。
|
int |
getColumnCount()
返回模型中的列数。
|
int |
getColumnIndex(Object columnIdentifier)
当使用
equals进行比较时,返回标识符等于
identifier的表中第一列的索引。
|
int |
getColumnIndexAtX(int xPosition)
返回位于水平点的列的索引 xPosition ;
如果它位于列的边界之外,则为-1。
|
int |
getColumnMargin()
返回每列中单元格之间的宽度。
|
Enumeration<TableColumn> |
getColumns()
返回
Enumeration中所有列的
Enumeration 。
|
boolean |
getColumnSelectionAllowed()
如果可以选择列,则返回true。
|
int |
getSelectedColumnCount()
返回所选列的数量。
|
int[] |
getSelectedColumns()
返回所有选定列的指标数组。
|
ListSelectionModel |
getSelectionModel()
返回当前的选择模型。
|
int |
getTotalColumnWidth()
返回所有列的总宽度。
|
void |
moveColumn(int columnIndex, int newIndex)
将列及其标题
columnIndex
newIndex 。
|
void |
removeColumn(TableColumn column)
从
tableColumns数组中删除
TableColumn
column 。
|
void |
removeColumnModelListener(TableColumnModelListener x)
删除表列模型事件的侦听器。
|
void |
setColumnMargin(int newMargin)
将
TableColumn的列边距设置为
newMargin 。
|
void |
setColumnSelectionAllowed(boolean flag)
设置是否可以选择此模型中的列。
|
void |
setSelectionModel(ListSelectionModel newModel)
设置选择模型。
|
void addColumn(TableColumn aColumn)
aColumn追加到tableColumns数组的末尾。
此方法将columnAdded事件发布到其监听器。
aColumn - 要添加的
TableColumn
removeColumn(javax.swing.table.TableColumn)
void removeColumn(TableColumn column)
tableColumns数组中删除TableColumn column 。
如果column不在表的列表中,则此方法将column 。
此方法将一个columnRemoved事件发布到其监听器。
column - 要删除的
TableColumn
addColumn(javax.swing.table.TableColumn)
void moveColumn(int columnIndex,
int newIndex)
columnIndex ,到newIndex 。
columnIndex的旧栏现在将在newIndex找到。
以前在newIndex的列向左或向右移动以腾出空间。
如果columnIndex等于newIndex则不会移动任何列。
此方法将columnMoved事件发布到其监听器。
columnIndex - 要移动的列的索引
newIndex - 列的新位置的索引
IllegalArgumentException - 如果
columnIndex或
newIndex不在有效范围内
void setColumnMargin(int newMargin)
TableColumn的列边距设置为newMargin 。
此方法将一个columnMarginChanged事件发布到其监听器。
newMargin - 新列边距的宽度(以像素为单位)
getColumnMargin()
int getColumnCount()
Enumeration<TableColumn> getColumns()
Enumeration中所有列的
Enumeration 。
Enumeration中所有列的
Enumeration
int getColumnIndex(Object columnIdentifier)
equals进行比较时,返回标识符等于
identifier的表中第一列的索引。
columnIdentifier - 标识符对象
identifier的第一个表列的
identifier
IllegalArgumentException - 如果
identifier是
null ,或没有
TableColumn有这个
identifier
getColumn(int)
TableColumn getColumn(int columnIndex)
TableColumn在列对象
columnIndex 。
columnIndex - 所需列的索引
TableColumn对象为
columnIndex
int getColumnMargin()
int getColumnIndexAtX(int xPosition)
xPosition ;
如果它位于列的边界之外,则为-1。
与Swing的可分离模型架构保持一致,TableColumnModel不知道表列如何在屏幕上实际显示。
列的视觉呈现是使用此模型(通常为JTable)的视图/控制器对象的责任。
视图/控制器不需要从左到右依次显示列。
例如,可以从右到左显示列,以容纳区域设置首选项,或者可能在用户的请求下隐藏某些列。
因为模型不知道列如何布置在屏幕上,所以给定的xPosition不应该被认为是2D图形空间中的坐标。
相反,它应该被认为是从模型中第一列开始的宽度。
如果需要2D空间中给定X坐标的列索引, JTable.columnAtPoint可以使用JTable.columnAtPoint 。
JTable.columnAtPoint(java.awt.Point)
int getTotalColumnWidth()
void setColumnSelectionAllowed(boolean flag)
flag - 如果可以选择列,则为true;
否则为虚假
getColumnSelectionAllowed()
boolean getColumnSelectionAllowed()
setColumnSelectionAllowed(boolean)
int[] getSelectedColumns()
int getSelectedColumnCount()
void setSelectionModel(ListSelectionModel newModel)
newModel - 一个
ListSelectionModel对象
getSelectionModel()
ListSelectionModel getSelectionModel()
ListSelectionModel对象
setSelectionModel(javax.swing.ListSelectionModel)
void addColumnModelListener(TableColumnModelListener x)
x - 一个
TableColumnModelListener对象
void removeColumnModelListener(TableColumnModelListener x)
x - 一个
TableColumnModelListener对象
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.