Problem with Cell Editor

Hi,

I have a table and one of the columns take a decimal value....for this I have a custom cell editor and a renderer.

But once I try to enter some value into that field and then resize/drag the column headers, the value entered is getting reset to the old value.

So I added a mouse listener on the header and when mouse presses, I am doing a stopCellEditing(). This is working, but the same problem is seen when the dialog containing this table is resized i.e if I enter some value in that column and then resize the dialog containing this table..the entered value is getting reset to the older value.

Can somebody suggest me on this. I also tried to add focus listener to that decimalTextFiedcomponent and upon focus lost, I am calling stopCellEditor..but this is not working...

Thanks

scsc

[836 byte] By [scsca] at [2007-11-27 7:01:08]
# 1

When changing the value in the cell, do you call table.setValueAt( ...) or you call table.getModel().setValueAt(...). (They ought to be the same though)

However, this is important cause you just need to make sure the new value gets to the TableModel else on repaint the table will display value in the model, no the new one in the view. Also, check if you are overriding the new set by replacing it from a database or some other storage point

icewalker2ga at 2007-7-12 18:51:57 > top of Java-index,Desktop,Core GUI APIs...
# 2
> for this I have a custom cell editor and a renderer.This happens with the default editor as well, so its a feature of JTable.
camickra at 2007-7-12 18:51:57 > top of Java-index,Desktop,Core GUI APIs...
# 3
Yes, its working when I update the model with the new value upon focus lost of that field. But one problem here is since I am putting in focus lost, when I edit something and press Esc then the old value is not restored i.e even on pressing Esc the model is getting updated.Thanks
scsca at 2007-7-12 18:51:57 > top of Java-index,Desktop,Core GUI APIs...