title: How do you remove selected rows from a JTable?
body: <p>I've tried this:</p>
  
  <pre><code>public void removeSelectedFromTable(JTable from)
  {
      int[] rows = from.getSelectedRows();
      TableModel tm= from.getModel();
  
      while(rows.length&gt;0)
      {
          ((DefaultTableModel)tm).removeRow(from.convertRowIndexToModel(rows[0]));
  
          rows = from.getSelectedRows();
      }
      from.clearSelection();
  }
  </code></pre>
  
  <p>But, it sometimes leaves one still there. What can be the problem?</p>