void () { if (myTable.isEditing()) { myTable.getCellEditor().stopCellEditing(); } final int[] selected = myTable.getSelectedRows(); if (selected == null || selected.length == 0) return; Arrays.sort(selected); for (int i = selected.length - 1; i >= 0; i--) { int idx = selected[i]; if (!removeItem(myData.get(idx))) continue; myData.remove(idx); } myTableModel.fireTableDataChanged(); int selection = selected[0]; if (selection >= myData.size()) { selection = myData.size() - 1; } if (selection >= 0) { myTable.setRowSelectionInterval(selection, selection); } }