Why this following code not working? where is the problem? My jTable is initiated as jTable1;
jTable1.setDefaultRenderer(Object.class,new TableCellRenderer(){
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component c = (Component) table.getCellRenderer(row, column);
c.setBackground(row%2==0 ? Color.white : Color.yellow);
return c;
};
});