1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| public class RenderTablePeriodFound extends DefaultTableCellRenderer {
private static final long serialVersionUID = 1L;
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 (isSelected) {
cell.setBackground(new Color(192, 216, 247));
} else {
if (row % 2 == 0) {
cell.setBackground(Color.white);
} else {
cell.setBackground(new Color(232, 246, 247));
}
}
if (column == 4 && value.equals("1,00")) {
cell.setBackground(Color.green);
}
return cell;
}
} |
Partager