use of javax.swing.table.JTableHeader in project knime-core by knime.
the class PMCCNodeView method changeRenderer.
private void changeRenderer(final String renderer) {
TableContentView tcv = m_tableView.getContentTable();
tcv.changeRenderer(DoubleCell.TYPE, renderer);
Component c = m_tableView.getCorner(JScrollPane.UPPER_LEFT_CORNER);
LegendCornerAll cornerRenderer = null;
if (c instanceof JTableHeader) {
JTableHeader corner = (JTableHeader) c;
TableCellRenderer ren = corner.getDefaultRenderer();
if (ren instanceof LegendCornerAll) {
cornerRenderer = (LegendCornerAll) ren;
}
}
if (cornerRenderer != null) {
if (renderer.equals(ColorRender.DESCRIPTION)) {
cornerRenderer.setPaintLegend(true);
// no need to set column header height, done by label UI
tcv.setColumnWidth(15);
TableCellRenderer r = m_tableView.getContentTable().getTableHeader().getDefaultRenderer();
if (r instanceof JLabel) {
((JLabel) r).setUI(new VerticalLabelUI());
}
} else {
cornerRenderer.setPaintLegend(false);
m_tableView.setColumnHeaderViewHeight(16);
tcv.setColumnWidth(75);
TableCellRenderer r = m_tableView.getContentTable().getTableHeader().getDefaultRenderer();
if (r instanceof JLabel) {
((JLabel) r).updateUI();
}
}
}
m_currentRendererID = renderer;
}
Aggregations