void (T element, int newRow) { int modelRow = myTableModel.getElementRow(element); if (modelRow < 0 || modelRow == newRow || newRow < 0 || newRow >= myTableModel.getRowCount()) { return; } int viewRow = myTable.convertRowIndexToView(modelRow); boolean wasSelected = myTable.getSelectionModel().isSelectedIndex(viewRow); myTableModel.changeElementRow(element, newRow); if (wasSelected) { selectRow(newRow); } }