J
Jorge Castro
Hi,
I am having the following annoying problem with a JTable(MyTableModel).
After constructing a MyTableModel extends AbstractTableModel, which gets its
data from a remote (RMI) database,
I add a new record to the database.
At this point, upon reception of a notification event from the remote
database triggered by the
successfull addition of the new record, another object triggers execution of
the fireTableRowsUpdated() method of the MyTableModel .
The fireTableRowsUpdated() sends an event to its listeners, in this case the
JTable, causing it to read the new data from
the remote database, updating itself.
This is the theory. What is happenning in practice is that:
1) the fireTableRowsUpdated() is called correctly
2) although I cannot verify that the JTable has received the above event, it
appers to have done so because
, in addition to being in the list of listeners of MyTableModel, I can
verify that some of the methods of the
AbstractTableModel get called (as they should) to updata the JTable.
For example after the new record is added to the database, the getRowCount()
and the getValueAt() are both called,
and try to read data from the database.
However, it appears that the getValueAt() method is not called enough times
to fully update the JTable and the new record
is not shown at all. Only when I mouse click on one of the cells are all
records displayed including the new added recorded.
Can anyone suggest the cause for this apparent problematic behaviour?
Why does the JTable fail to redraw itself showing the new record, after the
fireTableRowsUpdated() is called?
Thanks a lot
Jorge Castro
I am having the following annoying problem with a JTable(MyTableModel).
After constructing a MyTableModel extends AbstractTableModel, which gets its
data from a remote (RMI) database,
I add a new record to the database.
At this point, upon reception of a notification event from the remote
database triggered by the
successfull addition of the new record, another object triggers execution of
the fireTableRowsUpdated() method of the MyTableModel .
The fireTableRowsUpdated() sends an event to its listeners, in this case the
JTable, causing it to read the new data from
the remote database, updating itself.
This is the theory. What is happenning in practice is that:
1) the fireTableRowsUpdated() is called correctly
2) although I cannot verify that the JTable has received the above event, it
appers to have done so because
, in addition to being in the list of listeners of MyTableModel, I can
verify that some of the methods of the
AbstractTableModel get called (as they should) to updata the JTable.
For example after the new record is added to the database, the getRowCount()
and the getValueAt() are both called,
and try to read data from the database.
However, it appears that the getValueAt() method is not called enough times
to fully update the JTable and the new record
is not shown at all. Only when I mouse click on one of the cells are all
records displayed including the new added recorded.
Can anyone suggest the cause for this apparent problematic behaviour?
Why does the JTable fail to redraw itself showing the new record, after the
fireTableRowsUpdated() is called?
Thanks a lot
Jorge Castro