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()
{
DefaultTableModel dm = (DefaultTableModel) getModel();
dm.getDataVector().removeAllElements();
revalidate();
}
and
((DefaultTableModel)table.getModel()).setNumRows(0);
Neither of which would remove all the rows. Any ideas?