I need to remove all the rows in my JTable.
I have tried both of the following:
/**
* Removes all the rows in the table
*/
public void clearTable()
The simplest way to remove all rows from JTable, just use this method instead...
tablemodel.getDataVector().removeAllElements();
tablemodel.fireTableDataChanged();
tablemodel
is the model which you created for your table to add new rows. This is the shortest and fastest way of deleting all rows because what if you have thousands of rows? Looping?