Call TableCellRenderer after every setValueAt().

I've made a TableCellRenderer which colours some cells depending on some values. My only problem is, that it only colours the cells after a addRow() or similar and not after every setValueAt().

I want my table to colour the cells after every change in the table.

How is this possible?

[304 byte] By [EikHorsa] at [2007-10-3 11:31:48]
# 1
> How is this possible?Fire the appropriate event indicating what has changed.
sabre150a at 2007-7-15 13:58:30 > top of Java-index,Java Essentials,New To Java...
# 2
I know that something changes every time I call setValueAt().
EikHorsa at 2007-7-15 13:58:30 > top of Java-index,Java Essentials,New To Java...
# 3

Since I don't know how you have implemented your Table Model I can't be sure of the detail but if you have extended DefaultTableModel or AbstractTableModel then in method setvalueAt() you call fireTableCellUpdated() with whatever row and col you are updating. Something like

public void setValueAt(int row, int col)

{

// do your stuff to update the value

fireTableCellUpdated(row, col);)

}

sabre150a at 2007-7-15 13:58:30 > top of Java-index,Java Essentials,New To Java...