I've created two JFrame
s. Frame 1 has a JTable
and frame 2 has a JButton
. The JTable
contains data from a MySQL table. What I want to do is this: when I click the JButton
in frame 2, the JTable
in frame 1 needs to be refreshed. How can I do that?
Asked
Active
Viewed 2,204 times
0

mKorbel
- 109,525
- 20
- 134
- 319

Nayana Rajapaksha
- 161
- 2
- 2
- 12
1 Answers
1
Let your TableModel
export an Action
that fires the TableModelEvent
appropriate to any changes made. Use the Action
to construct the button. When the button is clicked and the Action
fires, any table listening to the table model will update automatically. There are related examples here and here.