Diptopol Dam
Diptopol Dam

Reputation: 815

Update JTable in runtime

I have a JTable which represents a database table. In runtime when I click a button I want to update my table from database. It is working if the button is in that panel where the table is. When I try to create an object from other class it is not working.

How can I update a JTable from outside of the class in running?

Upvotes: 0

Views: 509

Answers (1)

dogbane
dogbane

Reputation: 274828

Yes, you can. Just pass a reference to the TableModel to the other class. When the other class changes the TableModel, the JTable will be automatically updated.

Upvotes: 1

Related Questions