I am trying to change the color of entire row which is having a column of value "FAIL". Here is my code, which is changing only that particular column. But i want to change the entire row.
Can anyone please give me an idea?
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected, boolean hasFocus,int row,int col)
{
String s = table.getModel().getValueAt(row,col).toString();
if(s.equalsIgnoreCase("Fail")) {
setForeground(Color.red);
}else {
setForeground(null);
}
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
row, col);
}