I have an application that displays a GUI and this GUI displays a table with several columns and rows. I have a class that extends DefaultTableModel. I wrote the code that displays the GUI. When the database table changes, how would I updated the GUI dynamically? Do you have any sample code that does that?
Does your database have a feature that would allow it to call arbitrary Java Code when it is updated? Is the update happening from your Java code or do you have to respond to changes that occur to the table from outside your application? You have to determine these things in order to work out a strategy which lets you determine when the data has changed. You might have to have some thread periodically polling the data table for differences (using timestamps when you submit rows helps with this), or, if you are in control of when the data gets sent into the DB then maybe you could register a callback which gets informed when you commit the changes.
Joined: May 01, 2008
My Java code adds new records to the database table and it also updates the records. I would like to refresh the GUI after my Java code adds or updates records in the table, but I'm not sure how to do that.