本文整理匯總了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());
}
}
}