Reputation: 19395
Exactly what the question states. I created a custom tableModel
class and I want to clear the JTable
associated with that model on an actionPerformed
.
Upvotes: 0
Views: 3193
Reputation: 13686
You must remove the data from the TableModel used for the table.
If using the DefaultTableModel, just set the row count to zero. This will delete the rows and fire the TableModelEvent to update the GUI.
JTable table;
…
DefaultTableModel model = (DefaultTableModel) table.getModel();
model.setRowCount(0);
If using other TableModel please check the documentation.
Upvotes: 2