本文整理汇总了Java中org.jdesktop.swingx.table.TableColumnExt.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java TableColumnExt.setTitle方法的具体用法?Java TableColumnExt.setTitle怎么用?Java TableColumnExt.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.swingx.table.TableColumnExt
的用法示例。
在下文中一共展示了TableColumnExt.setTitle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: interactiveCustomColumnFactory
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Issue #1379-swingx: support access to underlying treeTableModel of TreeTableModelAdapter.
*
* Needed f.i. in a custom ColumnFactory to configure the hierarchical column specifically.
*/
public void interactiveCustomColumnFactory() {
JXTreeTable table = new JXTreeTable();
ColumnFactory factory = new ColumnFactory() {
/**
* @inherited <p>
*/
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
if (model instanceof TreeTableModelProvider) {
TreeTableModel treeTableModel = ((TreeTableModelProvider) model).getTreeTableModel();
if (treeTableModel.getHierarchicalColumn() == columnExt.getModelIndex()) {
columnExt.setTitle("Hierarchical: " + columnExt.getTitle());
}
}
}
};
table.setColumnFactory(factory);
table.setTreeTableModel(new FileSystemModel());
showWithScrollingInFrame(table, "custom columnFactory");
}
示例2: bind
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
private void bind() {
// <snip>JXTreeTable column customization
// configure and install a custom columnFactory, arguably data related ;-)
ColumnFactory factory = new ColumnFactory() {
String[] columnNameKeys = { "componentType", "componentName", "componentLocation", "componentSize" };
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
if (columnExt.getModelIndex() < columnNameKeys.length) {
columnExt.setTitle(DemoUtils.getResourceString(TreeTableDemo.class,
columnNameKeys[columnExt.getModelIndex()]));
}
}
};
treeTable.setColumnFactory(factory);
// </snip>
}
示例3: createCustomColumnFactory
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Creates and returns a custom columnFactory for testing.
* Sets column title to modelIndex.
*
* @return the custom ColumnFactory.
*/
protected ColumnFactory createCustomColumnFactory() {
ColumnFactory factory = new ColumnFactory() {
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
columnExt.setTitle(String.valueOf(columnExt.getModelIndex()));
}
};
return factory;
}
示例4: testPreferredHeight
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Issue 334-swingx: BasicTableHeaderUI.getPrefSize doesn't respect
* all renderere's size requirements.
*
*/
@Test
public void testPreferredHeight() {
JXTable table = new JXTable(10, 2);
TableColumnExt columnExt = table.getColumnExt(1);
columnExt.setTitle("<html><center>Line 1<br>Line 2</center></html>");
JXTableHeader tableHeader = (JXTableHeader) table.getTableHeader();
TableCellRenderer renderer = tableHeader.getCellRenderer(1);
Component comp = renderer.getTableCellRendererComponent(table,
columnExt.getHeaderValue(), false, false, -1, 1);
Dimension prefRendererSize = comp.getPreferredSize();
assertEquals("Header pref height must respect renderer",
prefRendererSize.height, tableHeader.getPreferredSize().height);
}
示例5: configureTitle
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
private void configureTitle(TableColumnExt columnExt) {
columnExt.setTitle(DemoUtils.getResourceString(baseClass, columnExt.getIdentifier().toString()));
}
示例6: beautifyColumnTitle
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
private void beautifyColumnTitle(TableColumnExt columnExt) {
if (titleStringValue != null) {
columnExt.setTitle(titleStringValue.getString(columnExt.getTitle()));
}
}