1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
public class CustomTableCellRenderer extends DefaultTableCellRenderer
{
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( value instanceof String)
{
String val = (Integer) value
if( val.intValue() == 0 )
{
cell.setBackground( Color.red );
}
else
{
cell.setBackground( Color.white );
}
}
return cell;
}
} |
Partager