3
I’m trying to change the color of the background header
of JTable
.
With this code I got:
public Principal() throws UnsupportedLookAndFeelException {
initComponents();
jTable.getTableHeader().setDefaultRenderer(new HeaderColor());
}
static public class HeaderColor extends DefaultTableCellRenderer {
public HeaderColor() {
setOpaque(true);
}
public Component getTableCellRendererComponent(JTable jTable, Object value, boolean selected, boolean focused, int row, int column) {
super.getTableCellRendererComponent(jTable, value, selected, focused, row, column);
setBackground(new java.awt.Color(255,255,255));
return this;
}
}
This is the result I expected, but it is without the header border. I need that border.
Is there any way to change this code to insert the border?
Ta using Nimbus theme?
– user28595