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()
I had multiple tables, so I created a method to clear "any" table:
private void deleteAllTableRows(JTable table) { DefaultTableModel model = (DefaultTableModel) table.getModel(); while( model.getRowCount() > 0 ){ model.removeRow(0); } }