Java JTable Row clearAllRows(JTable table)

Here you can find the source of clearAllRows(JTable table)

Description

clear All Rows

License

Apache License

Declaration

public static void clearAllRows(JTable table) 

Method Source Code

//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
    }
}

Related

  1. checkRow(DefaultTableModel table, List data, int row)
  2. contains(int row, TableModel model)
  3. copyRows(JTable table)
  4. createDBXMLFile(JTable table, String docField, String rowField, Connection con, boolean reuseConnection, String driver, String dsn, String user, String password, String tableName, String whereString, String orderByString, String groupByString, boolean convertCharsToEntites)
  5. createThrowableMessage(Throwable t)