I have a question that appears to have been asked before, but, having browsed the responses, does not appear to have been answered satisfactorily. I am adding items to a table, essentially a series of textfields with ok / cancel buttons in a JFrame that adds data to a list that is displayed in another JFrame in a JTable. Nothing terribly complicated there. My question is, what is the best method to call the Refresh() method that tells the JTable to repaint itself / revalidate itself? Should I just use a public static method called from the JFrame that is doing the adding, or is there an Event-like option in Java that would work better? Your thoughts?
Asked
Active
Viewed 1,496 times
1
-
1See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556) – Andrew Thompson May 11 '13 at 06:05
-
Does the accepted answer here work for you: http://stackoverflow.com/questions/3179136/jtable-how-to-refresh-table-model-after-insert-delete-or-update-the-data – Joe Coder May 11 '13 at 06:07
-
4The JTable is updated via changes to the model. The model will fire appropriate events when it changes, when instructs the table to update its view. This a common concept in Swing and forms part of the MVC paradigm used by Swing – MadProgrammer May 11 '13 at 06:20