Here you can find the source of clearAllRows(JTable table)
public static void clearAllRows(JTable table)
//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); }// ww w .j a v a2 s . c om } }