void () { if (!updatingListSelectionModel) { updatingListSelectionModel = true; try { Set<Integer> selectedRows = new HashSet<>(); int min = listSelectionModel.getMinSelectionIndex(); int max = listSelectionModel.getMaxSelectionIndex(); if (min != -1 && max != -1) { for (int counter = min; counter <= max; counter++) { if (listSelectionModel.isSelectedIndex(counter)) { selectedRows.add(Integer.valueOf(counter)); } } } super.resetRowSelection(); listSelectionModel.clearSelection(); for (final Integer row : selectedRows) { listSelectionModel.addSelectionInterval(row.intValue(), row.intValue()); } } finally { updatingListSelectionModel = false; } } // Notice how we don't message super if // updatingListSelectionModel is true. If // updatingListSelectionModel is true, it implies the // ListSelectionModel has already been updated and the // paths are the only thing that needs to be updated. }