Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Himesh Sharma
Added: Feb 5, 2021 7:55 AM
Modified: Feb 5, 2021 8:02 AM
Views: 4
Tags: jtable
  1. private void clearTable(JTable jTable) {
  2.    int totalRows = jTable.getRowCount();
  3.    DefaultTableModel model = (DefaultTableModel) jTable.getModel();
  4.    for (int i = totalRows - 1; i >= 0; i--) {
  5.        model.removeRow(i);
  6.    }
  7. }