Swing - fireTableCellUpdated causing row update!!!
I have a custom TableModel whose setValueAt() method makes a call to fireTableCellUpdated().
My app has a jTable that reads in a .dbf file.
I noticed that if I change any field in the second to the last row of the table, then the same field in the last row is also changed.This occurs only if I make changes to the second to the last row. But as soon as I comment out fireTableCellUpdated(), the problem goes away.
Is anyone else experiencing this?
Some background info:
1) I'm new to java
2) I call fireTableCellUpdated in my setValueAt method so that I can set a flag that I need, this flag is set in my tableChanged() method
3) I'm not using a jdbc driver to read the dbf file
TIA,
Jennifer
[758 byte] By [
jmc95825a] at [2007-11-26 23:26:16]

# 1
I have a custom TableModel whose setValueAt() method makes a call to fireTableCellUpdated().
Use the DefaultTableModel and see if you have the same problem.
I call fireTableCellUpdated in my setValueAt method so that I can set a flag that I need,
If you want to know when the TableModel has changed then add a TableModelListener to the TableModel.
Just realized I gave you the same advice 10 days ago, sometimes I wonder why I bother...
Message was edited by:
camickr
# 2
I have a custom TableModel whose setValueAt()
method makes a call to fireTableCellUpdated().
Use the DefaultTableModel and see if you have the
same problem.
Unfortunately I can't use the DefaultTableModel because of the file I'm reading in.
I call fireTableCellUpdated in my setValueAt method
so that I can set a flag that I need,
If you want to know when the TableModel has changed
then add a TableModelListener to the TableModel.
I do have a TableModelListener. I'm using the tableChanged method to set my flag.
Just realized I gave you the same advice 10 days ago,
sometimes I wonder why I bother...
Message was edited by:
camickr
# 3
Unfortunately I can't use the DefaultTableModel because of the file I'm reading in.
Don't see why this is a problem:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=595582
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.