Bick
Bick

Reputation: 18531

JTable - fire row changed when row deleted

In my system we use JTable with data model.

when data changes we remove it from the model, iterate the model and fire for each row listElementPropertyChanged (I think its intellij's). In this way removed lines are not deleted cause they are not in the model.

How do I refresh the whole table according to the model?

Upvotes: 1

Views: 3679

Answers (1)

Riduidel
Riduidel

Reputation: 22300

Simply use fireTableDataChanged(). This way, all listeners will now that all data may have changed. However, use it with care, as usual behaviour for listeners will be to refresh the whole table.

You would have better using fireTableRowsDeleted(int, int) with the removed rows indexes.

Upvotes: 3

Related Questions