Reputation: 490
I am playing around with some styles and ran into something I cant seem to find an answer for. I created a custom TableCellRenderer
and overrode getTableCellRenderComponent
, basically just changing the background color:
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
Component l = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
l.setBackground(Color.LIGHT_GRAY);
return l;
}
My problem is that when i call this to change say my table header background color, it removes the tables grid lines
table.getColumnModel().getColumn(k).setHeaderRenderer(newCustomTableCellRenderer());
Not sure why this is happening. How to fix it?
Upvotes: 1
Views: 606