public void actionPerformed(ActionEvent e) { UndoManager mgr = Undo.getLastUndoMgr(); if (mgr != null && mgr.canRedo()) mgr.redo(); }