Here is a code part of my project. I am try to change the color of desingated cells. But when i try it, all cells' color changing. Why is that ? Thanks.
private class cellRenderer extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if(row==column){
cell.setBackground(Color.yellow);
}
return cell;
}
}