DefaultTableModel model = (DefaultTableModel) table.getModel();
model.setRowCount(0);
model.setColumnCount(0);
DefaultTableModel dm = (DefaultTableModel) getModel();
int rowCount = dm.getRowCount();
//Remove rows one by one from the end of the table
for (int i = rowCount - 1; i >= 0; i--) {
dm.removeRow(i);
}
DefaultTableModel dtm = (DefaultTableModel) jtMyTable.getModel();
dtm.setRowCount(0);