void (ActionEvent e) { TableUtil.stopEditing(table); int index = table.getSelectedRow(); if (0 < index && index < tableModel.getRowCount()) { tableModel.exchangeRows(index, index - 1); table.setRowSelectionInterval(index - 1, index - 1); } IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(table, true)); }