public void actionPerformed(ActionEvent e) {
int[] sel = table.getSelectedRows();
if ((sel.length == 1) && (sel[0]+1 < base.getStringCount())) {
// Make sure no cell is being edited, as caused by the
// keystroke. This makes the content hang on the screen.
assureNotEditing();
/*int col = table.getEditingColumn(),
row = table.getEditingRow();
table.getCellEditor(row, col).stopCellEditing();*/
// Store undo information:
baseFrame.undoManager.addEdit(new UndoableMoveString
(baseFrame, base, sel[0], false));
BibtexString bs = base.getString(sel[0]);
base.removeString(sel[0]);
try {
base.addString(bs, sel[0]+1);
} catch (KeyCollisionException ex) {}
table.revalidate();
table.setRowSelectionInterval(sel[0]+1, sel[0]+1);
table.repaint();
baseFrame.markBaseChanged();
}
}
|