本文整理汇总了Java中org.jdesktop.swingx.table.DefaultTableColumnModelExt类的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableColumnModelExt类的具体用法?Java DefaultTableColumnModelExt怎么用?Java DefaultTableColumnModelExt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTableColumnModelExt类属于org.jdesktop.swingx.table包,在下文中一共展示了DefaultTableColumnModelExt类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSortableSetColumnModel
import org.jdesktop.swingx.table.DefaultTableColumnModelExt; //导入依赖的package包/类
/**
* Issue 1131-swingx: JXTable must guarantee to pass column sortable property
* always.
*
* Here: test that all columns in sortController are updated after setColumnModel.
*/
@Test
public void testSortableSetColumnModel() {
SortableTestFactory factory = new SortableTestFactory();
table.setAutoCreateColumnsFromModel(false);
table.setModel(sortableTableModel);
DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
// add two columns, one sortable, one not sortable
columnModel.addColumn(factory.createAndConfigureTableColumn(sortableTableModel, 0));
columnModel.addColumn(factory.createAndConfigureTableColumn(sortableTableModel, 1));
// hide unsortable column
columnModel.getColumnExt(1).setVisible(false);
table.setColumnModel(columnModel);
factory.assertSortableColumnState(table);
}
示例2: createTableWithCoreColumns
import org.jdesktop.swingx.table.DefaultTableColumnModelExt; //导入依赖的package包/类
/**
* Create and return a table with core column type.
*
* @return
*/
private JXTable createTableWithCoreColumns() {
JXTable table = new JXTable();
table.setAutoCreateColumnsFromModel(false);
table.setModel(sortableTableModel);
TableColumnModel columnModel = new DefaultTableColumnModelExt();
for (int i = 0; i < sortableTableModel.getColumnCount(); i++) {
TableColumn column = new TableColumn(i);
column.setHeaderValue(sortableTableModel.getColumnName(i));
column.setIdentifier(sortableTableModel.getColumnName(i));
columnModel.addColumn(column);
}
table.setColumnModel(columnModel);
return table;
}
示例3: updateTableHeader
import org.jdesktop.swingx.table.DefaultTableColumnModelExt; //导入依赖的package包/类
/**
* Updates table header. Gets the header value from table if cell header row
* is selected. Otherwise the header value is just column numbers.
*
*/
private void updateTableHeader(){
TableColumnModelExt model = new DefaultTableColumnModelExt();
Object[] columnTitles = conversionModel.getColumnTitles();
for(int column = 0; column < columnTitles.length; column++){
if(column >= this.getColumnCount()){
/*
* The TitleRowChangeEvent is fired after data chopping is done.
* This means that this method may be called before the table is updated.
* In this case, if the column count is changed, ArrayIndexOutOfBounds exception
* may occure.
*
* So, let's break the loop and wait that this method is called by updateTable
* method a bit later.
*/
break;
}
TableColumn newColumn = this.getColumnModel().getColumn(column);
if(column >= 1){
//Now text to the upper left corner cell
if(newColumn.getHeaderRenderer() instanceof PanelTableHeaderRenderer){
//For custom header of second step
((PanelTableHeaderRenderer)newColumn.getHeaderRenderer()).
setTitleText(columnTitles[column].toString());
} else {
//For step 1
newColumn.setHeaderValue(columnTitles[column]);
}
}
model.addColumn(newColumn);
}
this.setColumnModel(model);
logger.debug("Table header updated");
}
示例4: createDefaultColumnModel
import org.jdesktop.swingx.table.DefaultTableColumnModelExt; //导入依赖的package包/类
/**
*
* {@inheritDoc}
* <p>
*
* Overridden to return a <code>DefaultTableColumnModelExt</code>.
*
* @see org.jdesktop.swingx.table.DefaultTableColumnModelExt
*/
@Override
protected TableColumnModel createDefaultColumnModel() {
return new DefaultTableColumnModelExt();
}
示例5: createDefaultColumnModel
import org.jdesktop.swingx.table.DefaultTableColumnModelExt; //导入依赖的package包/类
/**
*
* {@inheritDoc}
* <p>
*
* Overridden to return a <code>DefaultTableColumnModelExt</code>.
* @see org.jdesktop.swingx.table.DefaultTableColumnModelExt
*/
@Override
protected TableColumnModel createDefaultColumnModel() {
return new DefaultTableColumnModelExt();
}