本文整理汇总了Java中javax.swing.table.TableColumnModel.getColumns方法的典型用法代码示例。如果您正苦于以下问题:Java TableColumnModel.getColumns方法的具体用法?Java TableColumnModel.getColumns怎么用?Java TableColumnModel.getColumns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.table.TableColumnModel
的用法示例。
在下文中一共展示了TableColumnModel.getColumns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTableSorted
import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
private boolean isTableSorted() {
TableColumnModel tcm = treeModelRoot.getOutlineView().getOutline().getColumnModel();
Enumeration<TableColumn> cen = tcm.getColumns();
while (cen.hasMoreElements()) {
ETableColumn etc = (ETableColumn) cen.nextElement();
if (etc.isSorted()) {
return true;
}
}
return false;
}
示例2: saveWidths
import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
private void saveWidths () {
if (columns == null) {
return;
}
int i, k = columns.length;
if (k == 0) {
return ;
}
TableColumnModel tcm = treeTable.getTable().getColumnModel();
ETableColumnModel ecm = (ETableColumnModel) tcm;
Enumeration<TableColumn> etc = tcm.getColumns();
boolean defaultState = true;
while(etc.hasMoreElements()) {
if (etc.nextElement().getWidth() != 75) {
defaultState = false;
break;
}
}
if (defaultState) {
// All columns have the default width 75.
// It's very likely that the table was not fully initialized => do not save anything.
return ;
}
logger.fine("\nsaveWidths():");
for (i = 0; i < k; i++) {
if (isHiddenColumn(i)) {
continue;
}
int visibleOrder = columnVisibleMap[i];
logger.log(Level.FINE, " visibleOrder[{0}] = {1}, ", new Object[]{i, visibleOrder});
if (visibleOrder >= tcm.getColumnCount()) {
continue;
}
TableColumn tc;
try {
tc = tcm.getColumn (visibleOrder);
} catch (ArrayIndexOutOfBoundsException aioobex) {
logger.log(Level.SEVERE,
"Column("+i+") "+columns[i].getName()+" visible index = "+visibleOrder+
", columnVisibleMap = "+java.util.Arrays.toString(columnVisibleMap)+
", num of columns = "+tcm.getColumnCount(),
aioobex);
continue ;
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, " GUI column = {0}", tc.getHeaderValue());
}
if (columns[i] instanceof Column) {
if (logger.isLoggable(Level.FINE)) {
logger.fine(" Setting width "+tc.getWidth()+" from "+tc.getHeaderValue()+" to "+columns[i].getDisplayName()+"["+i+"]");
}
((Column) columns[i]).setColumnWidth(tc.getWidth());
}
}
}