public void renameMotionBtn_clicked() { int row = motionTable.getSelectedRow(); if (row >= 0 && row < project.getMotions().size()) { Motion motion = project.getMotions().get(row); String s = StandardDialogs.promptForText( rootTabbedPane, "Please enter the new title:", motion.getDisplayLabel()); if (s != null) { motion.setCaption(s); refreshMotionTable(); if (row >= project.getMotions().size()) { row--; } if (row >= 0) { motionTable.getSelectionModel().setSelectionInterval(row, row); } motionTableClicked(); enableControls(); } } }