JTable coloring rows.
I have another question.
I want to set color for the whole row
Color of row depends on two cell in this row.
These to cells keep date.
If difference between dates is less than 7 days, then row is RED
else if difference is more than 7 days then the row is Green.
If user changes values in these cells, color of row should be repainted.
I've discovered topic in Forum Archive:
http://forum.java.sun.com/thread.jspa?threadID=433486&messageID=1979974
I am trying to use this part:
public Component getTableCellRendererComponent( JTable jTable, Object value,boolean isSelected,boolean hasFocus,int row,int col)
{
super.getTableCellRendererComponent(jTable, value, isSelected,hasFocus, row, col);
if(col==0){
int val = ((Integer)value).intValue();
int valMin = ((Integer)jTable.getModel().getValueAt(row,col+1)).intValue();
int valMax = ((Integer)jTable.getModel().getValueAt(row,col+2)).intValue();
setBackground(Color.green);
if( val>valMin )
setBackground(Color.yellow);
if( val>valMax)
setBackground(Color.red);
}
returnthis;
}
But I do not understand, how can I extend DefaultTableCellRenderer on replace it with Renderer I have shown to you.

