Java tutorial
//package com.java2s; //License from project: Apache License import javax.swing.*; import javax.swing.table.DefaultTableModel; public class Main { public static void clearAllRows(JTable table) { DefaultTableModel tableModel = (DefaultTableModel) table.getModel(); int rowCount = tableModel.getRowCount(); for (int i = 0; i < rowCount; i++) { tableModel.removeRow(rowCount - i - 1); } } }