public void fixSelection(int rows[]) { if (rows.length == 0) return; table.getSelectionModel().setValueIsAdjusting(true); int rowcount = table.getModel().getRowCount(); for (int x = 0; x < rows.length; x++) { if (rows[x] < rowcount) { table.getSelectionModel().addSelectionInterval(rows[x], rows[x]); } } table.getSelectionModel().setValueIsAdjusting(false); }