+ Reply to Thread
Results 1 to 2 of 2

Thread: delete selected rows from jTable?

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    13

    delete selected rows from jTable?

    How to delete selected rows from jtable?

  2. #2
    Junior Member
    Join Date
    Jun 2012
    Posts
    10
    I tried this one and it works
    Code:
    public void removeSelectedFromTable(JTable from)
    {
            int[] rows = from.getSelectedRows();
            TableModel tm = (DefaultTableModel) from.getModel();
    
    
            for (int row : rows) {
            	tm.removeRow(from.convertRowIndexToModel(row));
            }
    
            from.clearSelection();
    }

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts