1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
private class MyTableCellRenderer extends DefaultTableCellRenderer
{
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
Color c=null;
int actualRow=table.convertRowIndexToModel(row);
TupleFactureLine currentLine=itemsToRemind.get(actualRow);
long timeRemaining = currentLine.getNextFacturationTimeInMillis()-System.currentTimeMillis();
if(column==4)
{
if(timeRemaining > ONEMONTH)
setBackground(new Color(255,228,136));
else if(timeRemaining > ONEWEEK)
setBackground(new Color(255,203,21));
else if(timeRemaining > 0)
setBackground(new Color(250,82,1));
else
setBackground(Color.RED);
}
else
setBackground(Color.WHITE);
super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
return this;
}
} |
Partager