Hi what i am trying to do here is highlight a particular cell in a table using a custom cell renderer. And by the way this is my first cell renderer so i am really not sure what to do! ok now here is the renderer I have written and what I want it to do is highlight the cell at the 1st row of the column through which I call it. But it does not seem to do it, all it does is highlight all the rows in that column once I click a particular cell. Please help me with it.
public class CustomTableCellRenderer extends DefaultTableCellRenderer{
public Component getTableCellRendererComponent (JTable table,Object obj, boolean isSelected, boolean hasFocus, int row, int column) {
Component cell = super.getTableCellRendererComponent(table, obj, isSelected, hasFocus, row, column);
if (row == 1) {
cell.setBackground(Color.cyan);
}
return cell;
}
}