void () { int selectedRow = myTable.getSelectedRow(); myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); if (selectedRow != -1) { myTable.getSelectionModel().setSelectionInterval(selectedRow, selectedRow); } }