1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| JTable jtable = new JTable(warningListTableModel) {
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
Component component = super.prepareRenderer(renderer, row, column);
Object value = super.getValueAt(row, 2);
if ((Boolean) value)
component.setForeground(Color.ORANGE);
else {
value = super.getValueAt(row, 1);
if ((Integer) value > 0)
component.setForeground(Color.RED);
else
component.setForeground(Color.GREEN);
}
return component;
}
}; |
Partager