本文整理汇总了Java中javax.swing.table.JTableHeader.setDefaultRenderer方法的典型用法代码示例。如果您正苦于以下问题:Java JTableHeader.setDefaultRenderer方法的具体用法?Java JTableHeader.setDefaultRenderer怎么用?Java JTableHeader.setDefaultRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.table.JTableHeader
的用法示例。
在下文中一共展示了JTableHeader.setDefaultRenderer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTableEditor
import javax.swing.table.JTableHeader; //导入方法依赖的package包/类
public void setTableEditor(JTable table) {
this.table = table;
TableColumnModel columnModel = table.getColumnModel();
columnModel.getColumn(COL_CHECK).setCellRenderer(new BooleanTableCellRenderer());
columnModel.getColumn(COL_CHECK).setCellEditor(new BooleanTableCellEditor());
columnModel.getColumn(COL_CHECK).setPreferredWidth(50);
columnModel.getColumn(COL_TABLE).setPreferredWidth(100);
JTableHeader header = table.getTableHeader();
header.setDefaultRenderer(new ClassTableHeaderRenderer(table, true));
}
示例2: UpdateUIRecursionTest
import javax.swing.table.JTableHeader; //导入方法依赖的package包/类
public UpdateUIRecursionTest() {
super("UpdateUIRecursionTest");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(400, 400);
String[] columnNames = {
"First Name",
"Last Name",
"Sport",
"# of Years",
"Vegetarian"};
Object[][] data = {
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)}
};
JTableHeader tableHeader = new JTableHeader();
table = new JTable(data, columnNames);
table.setTableHeader(tableHeader);
tableHeader.setDefaultRenderer(this);
getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
setVisible(true);
}
示例3: setTable
import javax.swing.table.JTableHeader; //导入方法依赖的package包/类
public void setTable(JTable table) {
boolean checked = classEntity.getFieldList().size() == classEntity.getSelectedEntities().size();
this.table = table;
JTableHeader header = table.getTableHeader();
header.setDefaultRenderer(new FieldsTableHeaderRenderer(table, checked));
}