Here you can find the source of removeAllRows(JTable table)
public static void removeAllRows(JTable table)
//package com.java2s; //License from project: Apache License import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class Main { public static void removeAllRows(JTable table) { DefaultTableModel model = (DefaultTableModel) table.getModel(); for (int i = table.getRowCount() - 1; i > -1; i--) { model.removeRow(i);//from w w w . j a va 2 s .c o m } } }