0

I am using Derby and Eclipse/Java. I have a table in a database which populates a JTable in a scrollable frame. I enter data for a new row in textedit fields and commit to the database with an INSERT sql statement. I want the displayed table to automatically update and have googled extgensively to find out how to do this. I understand that fireTableRowsInserted should trigger this. I have a tableModel class extending AbstractTableModel. If I call fireTableRowsInserted from my entry class the table doesnt update. From searching I thought that the table listens for this event - do I have to create the listener, if so I havent been able to find a clear(to me!) indication of how this is done and would appreciate a pointer to a source that would help.

Is there a good book or online reference on using databses,sql and a Visual Designer with Java?

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
ron
  • 5,219
  • 8
  • 39
  • 44
  • Show us the code. Do you ever add the inserted item to the table model? – JB Nizet Jan 18 '12 at 09:11
  • There's an example [here](http://stackoverflow.com/a/7519403/230513). – trashgod Jan 18 '12 at 09:17
  • I've solved it by calling the getTableContents() method in my JDBCTableModel class. I shall spend more time investigating the adding of a just a row now. – ron Jan 18 '12 at 11:10

0 Answers0