I'm using NimbusLookAndFeel. With this look and feel JTable's cell background are alternatively white and light grey (it depends on the row number). Now, I'm writing some custom cell renderer implementing TableCellRenderer. I need to set the background of these renderers according to the position of the cell in the JTable.
public class MyCellRenderer extends JLabel implements TableCellRenderer{
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
Color bgColor = //need to retrieve the right cell background color
setBackground(bgColor);
return this;
}
}
How can I get such a Color value?