use of javax.swing.table.JTableHeader in project pcgen by PCGen.
the class ClassLevelTableModel method initializeTable.
public static void initializeTable(JTable classLevelTable) {
JTableHeader tableHeader = classLevelTable.getTableHeader();
tableHeader.setResizingAllowed(false);
tableHeader.setReorderingAllowed(false);
TableColumnModel columnModel = new DefaultTableColumnModel();
TableCellRenderer headerRenderer = tableHeader.getDefaultRenderer();
columnModel.addColumn(Utilities.createTableColumn(0, "Level", headerRenderer, false));
columnModel.addColumn(Utilities.createTableColumn(1, "HP", headerRenderer, false));
columnModel.addColumn(Utilities.createTableColumn(2, "Class (All Levels In Class)", headerRenderer, true));
classLevelTable.setColumnModel(columnModel);
classLevelTable.setAutoCreateColumnsFromModel(false);
classLevelTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
classLevelTable.setFocusable(false);
classLevelTable.setCellSelectionEnabled(false);
classLevelTable.setRowHeight(20);
}
use of javax.swing.table.JTableHeader in project pcgen by PCGen.
the class StatTableModel method initializeTable.
public static void initializeTable(JTable statsTable) {
JTableHeader tableHeader = statsTable.getTableHeader();
tableHeader.setResizingAllowed(false);
tableHeader.setReorderingAllowed(false);
statsTable.setAutoCreateColumnsFromModel(false);
DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
{
TableColumn column = Utilities.createTableColumn(ABILITY_NAME, "Ability", new AbilityHeaderCellRenderer(), true);
column.setIdentifier(ABILITY_COLUMN_ID);
columnModel.addColumn(column);
String htmlText = "<html><div align=\"center\">Final<br>Score</div></html>";
column = Utilities.createTableColumn(FINAL_ABILITY_SCORE, htmlText, new FixedHeaderCellRenderer(htmlText), false);
column.setCellRenderer(new ValueRenderer());
columnModel.addColumn(column);
TableCellRenderer renderer = new ModRenderer();
htmlText = "<html><div align=\"center\">Ability<br>Mod</div></html>";
column = Utilities.createTableColumn(ABILITY_MOD, htmlText, new FixedHeaderCellRenderer(htmlText), false);
column.setCellRenderer(renderer);
columnModel.addColumn(column);
htmlText = "<html><div align=\"center\">Editable<br>Score</div></html>";
column = Utilities.createTableColumn(EDITABLE_SCORE, htmlText, new FixedHeaderCellRenderer(htmlText), false);
column.setIdentifier(EDITABLE_COLUMN_ID);
columnModel.addColumn(column);
htmlText = "<html><div align=\"center\">Race<br>Adj</div></html>";
column = Utilities.createTableColumn(RACE_ADJ, htmlText, new FixedHeaderCellRenderer(htmlText), false);
column.setCellRenderer(renderer);
columnModel.addColumn(column);
htmlText = "<html><div align=\"center\">Misc<br>Adj</div></html>";
column = Utilities.createTableColumn(MISC_ADJ, htmlText, new FixedHeaderCellRenderer(htmlText), false);
column.setCellRenderer(renderer);
columnModel.addColumn(column);
}
statsTable.setColumnModel(columnModel);
statsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
statsTable.setShowVerticalLines(false);
statsTable.setCellSelectionEnabled(false);
statsTable.setFocusable(false);
// XXX this should be calculated relative to font size and the size of a jspinner
statsTable.setRowHeight(27);
statsTable.setOpaque(false);
tableHeader.setFont(FontManipulation.title(statsTable.getFont()));
FontManipulation.large(statsTable);
}
use of javax.swing.table.JTableHeader in project pcgen by PCGen.
the class SkillCostTableModel method initializeTable.
public static void initializeTable(JTable table) {
table.setAutoCreateColumnsFromModel(false);
JTableHeader header = table.getTableHeader();
TableColumnModel columns = new DefaultTableColumnModel();
TableCellRenderer headerRenderer = header.getDefaultRenderer();
columns.addColumn(Utilities.createTableColumn(0, //$NON-NLS-1$
LanguageBundle.getString("in_skillSkillCost"), headerRenderer, true));
columns.addColumn(Utilities.createTableColumn(1, //$NON-NLS-1$
LanguageBundle.getString("in_skillRankCost"), headerRenderer, false));
columns.addColumn(Utilities.createTableColumn(2, //$NON-NLS-1$
LanguageBundle.getString("in_skillMaxRanks"), headerRenderer, false));
table.setColumnModel(columns);
table.setFocusable(false);
table.setCellSelectionEnabled(false);
header.setReorderingAllowed(false);
header.setResizingAllowed(false);
}
use of javax.swing.table.JTableHeader in project pcgen by PCGen.
the class SkillPointTableModel method initializeTable.
public static void initializeTable(JTable table) {
table.setAutoCreateColumnsFromModel(false);
JTableHeader header = table.getTableHeader();
TableColumnModel columns = new DefaultTableColumnModel();
TableCellRenderer headerRenderer = header.getDefaultRenderer();
columns.addColumn(Utilities.createTableColumn(0, "in_level", headerRenderer, false));
columns.addColumn(Utilities.createTableColumn(1, "in_class", headerRenderer, true));
TableColumn remainCol = Utilities.createTableColumn(2, "in_iskRemain", headerRenderer, false);
remainCol.setCellRenderer(new BoldNumberRenderer());
columns.addColumn(remainCol);
columns.addColumn(Utilities.createTableColumn(3, "in_gained", headerRenderer, false));
table.setDefaultRenderer(Integer.class, new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
table.setColumnModel(columns);
table.setFocusable(false);
header.setReorderingAllowed(false);
header.setResizingAllowed(false);
}
use of javax.swing.table.JTableHeader in project beast-mcmc by beast-dev.
the class TaxonSetPanel method initTaxonSetsTable.
protected void initTaxonSetsTable(AbstractTableModel tableModel, final String[] columnToolTips) {
taxonSetsTable = new JTable(tableModel) {
//Implement table header tool tips.
protected JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) {
public String getToolTipText(MouseEvent e) {
Point p = e.getPoint();
int index = columnModel.getColumnIndexAtX(p.x);
int realIndex = columnModel.getColumn(index).getModelIndex();
return columnToolTips[realIndex];
}
};
}
};
taxonSetsTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
taxonSetsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
taxonSetsTableSelectionChanged();
}
});
taxonSetsTable.doLayout();
}
Aggregations