I have an implementation of a DefaultTableCellRenderer. When someone selects a row in the table, the row gets highlighted green. If I wanted to highlight the row under the one selected what is the easiest way to achieve this? Is this even possible without having to re-render the entire table?
So at the moment, I have something that looks like this:
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
int row, int column) {
Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (isSelected) {
component.setBackground(Color.GREEN);
// Somewhere here I would like to retrieve the row below the current row and give it another color
} else {
component.setBackground(Color.WHITE);
}
return component;
}