| |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
javax.swing.table
类 DefaultTableColumnModel
java.lang.Object javax.swing.table.DefaultTableColumnModel
- 所有已实现的接口:
- PropertyChangeListener, Serializable, EventListener, ListSelectionListener, TableColumnModel
public class DefaultTableColumnModel
- extends Object
- implements TableColumnModel, PropertyChangeListener, ListSelectionListener, Serializable
JTable
的标准列处理程序。
警告:此类的已序列化对象与以后的 Swing 版本不兼容。当前的序列化支持适用于短期存储或运行相同 Swing 版本的应用程序之间的 RMI。从 1.4 版本开始,已在 java.beans
包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder
。
- 另请参见:
JTable
字段摘要 | |
---|---|
protected ChangeEvent | changeEvent 更改事件(只需要一个) |
protected int | columnMargin 每列之间的空白宽度 |
protected boolean | columnSelectionAllowed 此列模型中允许的列选择 |
protected EventListenerList | listenerList TableColumnModelListener 的列表 |
protected ListSelectionModel | selectionModel 跟踪列选择的模型 |
protected Vector<TableColumn> | tableColumns 此模型中 TableColumn 对象组成的数组 |
protected int | totalColumnWidth 所有列总宽度的本地缓存 |
构造方法摘要 | |
---|---|
DefaultTableColumnModel() 创建默认的表列模型。 |
方法摘要 | ||
---|---|---|
void | addColumn(TableColumn aColumn) 将 aColumn 追加到 tableColumns 数组的结尾。 | |
void | addColumnModelListener(TableColumnModelListener x) 添加表列模型事件的侦听器。 | |
protected ListSelectionModel | createSelectionModel() 创建新的默认列表选择模型。 | |
protected void | fireColumnAdded(TableColumnModelEvent e) 通知所有对此事件类型的通知感兴趣的已注册侦听器。 | |
protected void | fireColumnMarginChanged() 通知所有对此事件类型的通知感兴趣的已注册侦听器。 | |
protected void | fireColumnMoved(TableColumnModelEvent e) 通知所有对此事件类型的通知感兴趣的已注册侦听器。 | |
protected void | fireColumnRemoved(TableColumnModelEvent e) 通知所有对此事件类型的通知感兴趣的已注册侦听器。 | |
protected void | fireColumnSelectionChanged(ListSelectionEvent e) 通知所有对此事件类型的通知感兴趣的已注册侦听器。 | |
TableColumn | getColumn(int columnIndex) 返回 columnIndex 处列的 TableColumn 对象。 | |
int | getColumnCount() 返回 tableColumns 数组中的列数。 | |
int | getColumnIndex(Object identifier) 返回 tableColumns 数组中第一列的索引,当使用 equals 进行比较时,该列的标识符等于 identifier 。 | |
int | getColumnIndexAtX(int x) 返回位于 x 处列的索引,如果该点处没有列,则返回 -1。 | |
int | getColumnMargin() 返回 TableColumn 的空白宽度。 | |
TableColumnModelListener[] | getColumnModelListeners() 返回一个包含在此模型上注册的所有列模型侦听器的数组。 | |
Enumeration<TableColumn> | getColumns() 返回该模型中所有列的一个 Enumeration 。 | |
boolean | getColumnSelectionAllowed() 如果允许列选择,则返回 true,否则返回 false。 | |
| getListeners(Class<T> listenerType) 返回当前已在此模型上注册为 FooListener 的所有对象组成的数组。 | |
int | getSelectedColumnCount() 返回选定的列数。 | |
int[] | getSelectedColumns() 返回包含选定列的数组。 | |
ListSelectionModel | getSelectionModel() 返回用来维护列选择状态的 ListSelectionModel 。 | |
int | getTotalColumnWidth() 返回所有列的总宽度。 | |
void | moveColumn(int columnIndex, int newIndex) 将 columnIndex 位置的列和标题移到 newIndex 。 | |
void | propertyChange(PropertyChangeEvent evt) Property Change Listener 更改方法。 | |
protected void | recalcWidthCache() 重新计算所有列的总宽度。 | |
void | removeColumn(TableColumn column) 从 tableColumns 数组删除 column 。 | |
void | removeColumnModelListener(TableColumnModelListener x) 移除表列模型事件的侦听器。 | |
void | setColumnMargin(int newMargin) 将列空白设置为 newMargin 。 | |
void | setColumnSelectionAllowed(boolean flag) 设置是否允许列选择。 | |
void | setSelectionModel(ListSelectionModel newModel) 将此 TableColumnModel 的选择模型设置为 newModel ,并为来自新选择模型的侦听器通知注册它。 | |
void | valueChanged(ListSelectionEvent e) 列选择更改时转发 ListSelectionEvents 的 ListSelectionListener 。 |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
tableColumns
protected Vector<TableColumn> tableColumns
- 此模型中 TableColumn 对象组成的数组
selectionModel
protected ListSelectionModel selectionModel
- 跟踪列选择的模型
columnMargin
protected int columnMargin
- 每列之间的空白宽度
listenerList
protected EventListenerList listenerList
- TableColumnModelListener 的列表
changeEvent
protected transient ChangeEvent changeEvent
- 更改事件(只需要一个)
columnSelectionAllowed
protected boolean columnSelectionAllowed
- 此列模型中允许的列选择
totalColumnWidth
protected int totalColumnWidth
- 所有列总宽度的本地缓存
构造方法详细信息 |
---|
DefaultTableColumnModel
public DefaultTableColumnModel()
- 创建默认的表列模型。
方法详细信息 |
---|
addColumn
public void addColumn(TableColumn aColumn)
- 将
aColumn
追加到tableColumns
数组的结尾。此方法还将columnAdded
事件发送到它的侦听器。 - 指定者:
- 接口
TableColumnModel
中的addColumn
- 参数:
aColumn
- 要添加的TableColumn
- 抛出:
IllegalArgumentException
- 如果aColumn
为null
- 另请参见:
removeColumn(javax.swing.table.TableColumn)