Undo/Redo help please...

I want to include undo/redo capabilities in my app. All the examples and code that I've seen deals with text. Can undo/redo handle undoing the move of an object(from one side of screen to the other), undoing the adding of a label or panel to a frame, etc..? If so could someone point me in the right direction or post some sample code.
thanks...

how do i redraw the contents of a panel again. I don't know about the internals of your program. I just described a general approach to undo levels.
If you're adding labels to a panel, then you're trying to undo the GUI itself? What, are you trying to make some kind of rapid prototyping tool for java GUIs? If so, the problem I see here is that you may have to re-compile and re-run the app being designed every time you make a change.
Or is "label" relevant only to your app with nothing to do with java labels?
this panel is inside an internalframe ...
redraw only that panel without redrawing other parts of the window. AWT handles this fine. Swing probably does as well though I don't know.
but if i move the cursor to the controls in the applet whole
labels which i moved in the panel comes to their
original position. how do i fix this.This depends on how you implemented it. There's no way someone reading this forum can see what your problem is from this description and give you a repair. Maybe someone who has worked on similar projects can hazard a reasonable guess.

Similar Messages

  • Need Undo/Redo Help

    hi,
    I'm trying to make a program where I can undo any sort of action and also redo it.
    I have created a sample; can't get it to work with the undomanager.
    Help. Thanks.
       import javax.swing.*;
       import javax.swing.undo.*;
       import java.awt.*;
       import java.awt.event.*;
        public class UndoManagerTest extends JPanel implements ActionListener
          JButton add;
          JButton undo;
          JButton redo;
          JPanel panel, buttonpanel;
          UndoManager manager;
           public UndoManagerTest()
             manager = new UndoManager();
             setPreferredSize(new Dimension(800, 600));
             setLayout(new BorderLayout());
             panel = new JPanel(new FlowLayout());
             buttonpanel = new JPanel();
             panel.setPreferredSize(new Dimension(800, 400));
             // this.addUndoableEditListener(manager);
             add = new JButton("Add Label");
             add.addActionListener(this);
             undo = new JButton("Undo");
             undo.addActionListener(this);
             redo = new JButton("Redo");
             redo.addActionListener(this);
             buttonpanel.add(add);
             buttonpanel.add(undo);
             buttonpanel.add(redo);
             add(panel, BorderLayout.NORTH);
             add(buttonpanel, BorderLayout.SOUTH);          
           public void actionPerformed(ActionEvent e)
             if(e.getSource() == add)
                panel.add(new JLabel("New Label"));
                panel.updateUI();
             if(e.getSource() == undo)
                if(manager.canUndo())
                   try
                      manager.undo();
                       catch(CannotUndoException b)
             if(e.getSource() == redo)
                try
                   manager.redo();
                    catch(CannotRedoException b)
           public static void main (String[] args)
             JFrame frame = new JFrame("UndoManagerTest");
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             frame.add(new UndoManagerTest());               
             frame.setVisible(true);
             frame.pack();
       }

    Everything can be done.
    You don't undo clicking a button. You undo what your programa did when the button was clicked. In other words if you, for instance, created a jlabel and put it in a jpanel. You must "save" that information so the jlabel can be removed and/or be put again if the user wants.
    How you do that? You create an undoEdit class for every kind of "event" you want to undo. When I say event I don't mean java event like mouseEvents but your own doing in the methods.
    This is an example of one of my undoEdits:
    import javax.swing.undo.*;
    public class UndoBorder extends AbstractUndoableEdit{
        Parent parent; // any object you want to use like a Jframe o whatever
        int r, c;
        Border old, neww;
        String key;
        public UndoBorder(Parent parent, int r, int c, String key, Border old, Border neww) {
          this.parent=parent;
          this.r=r;
          this.c=c;
          this.key=key;
          this.old=old;
          this.neww=neww;
        public void undo(){
          if(old == null) parent.getBorders().remove(key);
          else parent.getBorders().put(key, old);
        public void redo(){
          if(neww == null) parent.getBorders().remove(key);
          else parent.getBorders().put(key, neww);
        // I don't recall why this is here but don't remove it cause it is necessary.
        public boolean canUndo(){ return true; }
        public boolean canRedo(){ return true; }
    }How do you use this:
    When I create a border and add it to the application (a hashMap) I also create the undo so the user can undo the action:
    Border neww = new Border(row, col, true, BorderLines.THIN, black);
    borders.put(row+colS, neww);
    edit.addEdit(new UndoBorder(this, row, col, row+colS, old, neww));In case you need to undo several action at once you have to create a CompoundUndoEdit object. Let me know if you need it.

  • I made a dumb decision to 'Erase Free Space' on my drive. I now have no free space, I realize because it wrote 0's over all my free space. Is there a way to undo this??? Help please I can't save any documents now! Thanks in advance all, it is truly apprec

    I made a dumb decision to 'Erase Free Space' on my drive. I now have no free space, I realize because it wrote 0's over all my free space. Is there a way to undo this??? Help please I can't save any documents now! Thanks in advance all, it is truly appreciated. how can find the hidden temporary files using the terminal what do i type in?

    It's more likely a failed Erase Free Space, which creates a huge temporary file; that's why it looks like you have no more available drive space. You can recover from this. See these links
    https://discussions.apple.com/message/10938738#10938738
    http://www.macgeekery.com/tips/quickie/recovering_from_a_failed_secure_erase_fre e_space 
    Post back if you need any help with this.

  • HELP PLEASE!  I logged in with my iCloud account and merged her contacts with mine how can I undo this If i log out her contacts erase and stay on my iPhone and visa versa

    HELP PLEASE!  I logged in with my iCloud account and merged her contacts with mine how can I undo this If i log out her contacts erase and stay on my iPhone and visa versa

    One of you will need to migrate to a separate iCloud account, then you can delete the other person's data from each account.
    To migrate to a new account, start by saving an photo stream photos that are not in your camera roll to your camera roll.  To do this, open your my photo stream album, tap Select, tap the photos, tap the share icon (box with upward pointing errow), then tap Save to Camera Roll.  Then go to Settings>iCloud, tap Delete Account, choose Keep on My iPhone when prompted, provide the account password to turn off Find My iPhone when prompted, then sign in with a different Apple ID to create the new account and choose Merge to upload your data.
    You can then each to to your iCloud accounts on icloud.com from your computer and delete the other person's data from your account.

  • How can I undo Foxfire, it was added accidently, Help please.

    How can I completely delete Foxfire from my computer, it was added accidently and nothing I have been able to try, allows me to delete it. Help Please!

    Get real!!! I need to uninstall this monster "Foxfire". While I respect the fact that some users are satisfied with it and use it; I, unfortunately, am not one of those people. And my experience is that once you make the mistake of installing it, there is no return. I find that incredibly unacceptable. If this is such a fine thing, then why is it "too" easy to download it and virtually impossible to uninstall it??????????????

  • Undo/Redo button are not performing more than one operation at a time

    Hi,
    I have created undo/redo button on my paint application. But it performing only last action to undo.I have just the code which store offscreen image into undo buffer image like this :
        if (OSC == null || widthOfOSC != getSize().width || heightOfOSC != getSize().height) {
                     // Create the OSC, or make a new one if canvas size has changed.
                 OSC = null;  // (If OSC & undoBuffer already exist, this frees up the memory.)
                 undoBuffer = null;
                 OSC = createImage(getSize().width, getSize().height);
                 widthOfOSC = getSize().width;
                 heightOfOSC = getSize().height;
                 OSG = OSC.getGraphics();  // Graphics context for drawing to OSC.
                 OSG.setColor(getBackground());              
                 OSG.dispose();
                 undoBuffer = createImage(widthOfOSC, heightOfOSC);
                  OSG = undoBuffer.getGraphics();  // Graphics context for drawing to the undoBuffer.
                  OSG.setColor(getBackground());            
                  OSG.fillRect(0, 0,widthOfOSC, heightOfOSC);
                   and the button performed it's action :
    else if (command.equals("Undo")) {
                 // Swap the off-screen canvas with the undoBuffer and repaint.
                 Image temp = OSC;
                 OSC = undoBuffer;
                 undoBuffer = temp;
                 repaint();I want to create undo button that performed end operation on canvas.
    please help me
    Thanks in advance....

    Don't post the same question repeatedly. I've removed the thread you started 4 days after this one with the identical same question.
    db

  • Undo Redo Function

    Hi all,
    I want to implement Undo Redo functionality in my application.For example , I have a JFrame with a button in it. On clicking the button i am importing a image in to it,and performing some action like resizing the image and dragging it within the frame.What if i want to go back in the process.I have no idea about it.Please help me do that.
    Thanks in advance
    Ravisenan

    This is far from being easy...
    Basically, you have to put every action on a stack, where you can recall them. Each action must contain ALL Information that has been changed, before it was changed. So when you undo it, you copy back all necessary properties.
    Based on the complexity and design of your program, this can be one hell of a problem. I wish you good luck.

  • Can't get into IPad 2 after latest update.  HELP, PLEASE!??

    I made the mistake of updating my IPad 2 to the latest IOS7.  Now I cannot get into it.  When I turn it on, it says 'hello' and to swipe to set up the new update.  Sometimes the swipe brings up a new screen; sometimes it just scrolls through several languages.  Sometimes it asks for my Apple ID and gets as far as "updating ICloud."  It NEVER finishes updating ICloud! 
    I cannot reach my apps or a normal looking screen.  Can someone help, please?  Is there any way to get this update to work or to UNDO the update?  I'll be grateful if you can help.......  Thank you so much!
    Virginia

    1. Slide to set up
    2. Select language
    3. Select country/region
    4. Choose Wi-Fi Network
    5. Enable/Disable Location Service
    6. Enter Apple ID and Password
    7. (a) Set Up as New (b) Restore from iCloud Backup (c) Restore from iTune Backup
    8. Terms and Conditions
    9. Use iCloud/Don't use iCloud
    10. Create/Don't create Passcode
    11. Diagnostics
    12. Welcome to iPad

  • To many undo redo button

    Hi to everyone!!!
    I need your advice for my problem!!
    when I cliked new in the file to create a new JTextPane the undo redo button will multiply and if I have so many JTextPane then I have many undo redo in my toolbar
    here is my code.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import java.util.*;
    import javax.swing.undo.*;
    public class URTest extends JFrame {
         JToolBar toolBar = new JToolBar();
         JButton undo;
         JButton redo = new JButton("Redo");
         JMenuBar menuBar = new JMenuBar();
         JMenu menu = new JMenu("File");
         JMenuItem item = new JMenuItem("New");
         JMenuItem item2 = new JMenuItem("Close");
         JTabbedPane tabbedPane = new JTabbedPane();
         JTextPane pane;
         public URTest() {
              item.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        create();
              item2.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        removeCreate();
              menu.add(item);
              menu.add(item2);
              menuBar.add(menu);
              this.add(toolBar,BorderLayout.NORTH);
              this.add(tabbedPane);
              this.setJMenuBar(menuBar);
         void create() {
              undo = new JButton("Undo");
              redo = new JButton("Redo");
              pane = new JTextPane();
              EditorKit editorKit = new StyledEditorKit() {
                   public Document createDefaultDocument() {
                        return new SyntaxDocument();
              pane.setEditorKit(editorKit);
              final CompoundUndoManager undoManager = new CompoundUndoManager( pane );
              undo.addActionListener( new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        try
                             undoManager.undo();
                             pane.requestFocus();
                        catch (CannotUndoException ex)
                             System.out.println("Unable to undo: " + ex);
              redo.addActionListener( new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        try
                             undoManager.redo();
                             pane.requestFocus();
                        catch (CannotRedoException ex)
                             System.out.println("Unable to redo: " + ex);
              toolBar.add(undo);
              toolBar.add(redo);
              tabbedPane.addTab("Tab",pane);
         void removeCreate() {
              tabbedPane.remove(tabbedPane.getSelectedIndex());
         public static void main(String[] args) {
              URTest frame = new URTest();
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              frame.setSize(400,400);
              frame.setVisible(true);
    class CompoundUndoManager extends UndoManager
         implements UndoableEditListener, DocumentListener
         public CompoundEdit compoundEdit;
         private JTextComponent editor;
         //  These fields are used to help determine whether the edit is an
         //  incremental edit. For each character added the offset and length
         //  should increase by 1 or decrease by 1 for each character removed.
         private int lastOffset;
         private int lastLength;
         public CompoundUndoManager(JTextComponent editor)
              this.editor = editor;
              editor.getDocument().addUndoableEditListener( this );
         **  Add a DocumentLister before the undo is done so we can position
         **  the Caret correctly as each edit is undone.
         public void undo()
              editor.getDocument().addDocumentListener( this );
              super.undo();
              editor.getDocument().removeDocumentListener( this );
         **  Add a DocumentLister before the redo is done so we can position
         **  the Caret correctly as each edit is redone.
         public void redo()
              editor.getDocument().addDocumentListener( this );
              super.redo();
              editor.getDocument().removeDocumentListener( this );
         **  Whenever an UndoableEdit happens the edit will either be absorbed
         **  by the current compound edit or a new compound edit will be started
         public void undoableEditHappened(UndoableEditEvent e)
              //  Start a new compound edit
              if (compoundEdit == null)
                   compoundEdit = startCompoundEdit( e.getEdit() );
                   lastLength = editor.getDocument().getLength();
                   return;
              //  Check for an attribute change
              AbstractDocument.DefaultDocumentEvent event =
                   (AbstractDocument.DefaultDocumentEvent)e.getEdit();
              if  (event.getType().equals(DocumentEvent.EventType.CHANGE))
                   compoundEdit.addEdit( e.getEdit() );
                   return;
              //  Check for an incremental edit or backspace.
              //  The change in Caret position and Document length should be either
              //  1 or -1 .
              int offsetChange = editor.getCaretPosition() - lastOffset;
              int lengthChange = editor.getDocument().getLength() - lastLength;
              if (Math.abs(offsetChange) == 1
              &&  Math.abs(lengthChange) == 1)
                   compoundEdit.addEdit( e.getEdit() );
                   lastOffset = editor.getCaretPosition();
                   lastLength = editor.getDocument().getLength();
                   return;
              //  Not incremental edit, end previous edit and start a new one
              compoundEdit.end();
              compoundEdit = startCompoundEdit( e.getEdit() );
         **  Each CompoundEdit will store a group of related incremental edits
         **  (ie. each character typed or backspaced is an incremental edit)
         private CompoundEdit startCompoundEdit(UndoableEdit anEdit)
              //  Track Caret and Document information of this compound edit
              lastOffset = editor.getCaretPosition();
              lastLength = editor.getDocument().getLength();
              //  The compound edit is used to store incremental edits
              compoundEdit = new MyCompoundEdit();
              compoundEdit.addEdit( anEdit );
              //  The compound edit is added to the UndoManager. All incremental
              //  edits stored in the compound edit will be undone/redone at once
              addEdit( compoundEdit );
              return compoundEdit;
         //  Implement DocumentListener
         //      Updates to the Document as a result of Undo/Redo will cause the
         //  Caret to be repositioned
         public void insertUpdate(final DocumentEvent e)
              SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        int offset = e.getOffset() + e.getLength();
                        offset = Math.min(offset, editor.getDocument().getLength());
                        editor.setCaretPosition( offset );
         public void removeUpdate(DocumentEvent e)
              editor.setCaretPosition(e.getOffset());
         public void changedUpdate(DocumentEvent e)      {}
         class MyCompoundEdit extends CompoundEdit
              public boolean isInProgress()
                   //  in order for the canUndo() and canRedo() methods to work
                   //  assume that the compound edit is never in progress
                   return false;
              public void undo() throws CannotUndoException
                   //  End the edit so future edits don't get absorbed by this edit
                   if (compoundEdit != null)
                        compoundEdit.end();
                   super.undo();
                   //  Always start a new compound edit after an undo
                   compoundEdit = null;

    I was not actually sure what you wanted so I made the wild guess that you actually wanted only one pair of Undo/Redo buttons. Here you go :import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.util.List;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import javax.swing.undo.*;
    public class URTest extends JPanel {
         private JMenuBar theMenuBar;
         private JTabbedPane theTabbedPane;
         private List<Pane> thePanes;
         private static class Pane {
              private JTextPane theTextPane;
              private CompoundUndoManager theUndoManager;
              private class CompoundUndoManager extends UndoManager implements UndoableEditListener, DocumentListener {
                   public CompoundEdit compoundEdit;
                   private int lastOffset;
                   private int lastLength;
                   public CompoundUndoManager() {
                        compoundEdit = null;
                   public void undo() {
                        theTextPane.getDocument().addDocumentListener(this);
                        super.undo();
                        theTextPane.getDocument().removeDocumentListener(this);
                   public void redo() {
                        theTextPane.getDocument().addDocumentListener(this);
                        super.redo();
                        theTextPane.getDocument().removeDocumentListener(this);
                   public void undoableEditHappened(UndoableEditEvent e) {
                        if (compoundEdit == null) {
                             compoundEdit = startCompoundEdit(e.getEdit());
                             lastLength = theTextPane.getDocument().getLength();
                             return;
                        AbstractDocument.DefaultDocumentEvent event = (AbstractDocument.DefaultDocumentEvent)e.getEdit();
                        if (event.getType().equals(DocumentEvent.EventType.CHANGE)) {
                             compoundEdit.addEdit(e.getEdit());
                             return;
                        int offsetChange = theTextPane.getCaretPosition() - lastOffset;
                        int lengthChange = theTextPane.getDocument().getLength() - lastLength;
                        if (Math.abs(offsetChange) == 1
                             && Math.abs(lengthChange) == 1) {
                             compoundEdit.addEdit(e.getEdit());
                             lastOffset = theTextPane.getCaretPosition();
                             lastLength = theTextPane.getDocument().getLength();
                             return;
                        compoundEdit.end();
                        compoundEdit = startCompoundEdit(e.getEdit());
                   private CompoundEdit startCompoundEdit(UndoableEdit anEdit) {
                        lastOffset = theTextPane.getCaretPosition();
                        lastLength = theTextPane.getDocument().getLength();
                        compoundEdit = new MyCompoundEdit();
                        compoundEdit.addEdit(anEdit);
                        addEdit(compoundEdit);
                        return compoundEdit;
                   public void insertUpdate(final DocumentEvent e) {
                        SwingUtilities.invokeLater(new Runnable() {
                             public void run() {
                                  int offset = e.getOffset() + e.getLength();
                                  offset = Math.min(offset, theTextPane.getDocument().getLength());
                                  theTextPane.setCaretPosition(offset);
                   public void removeUpdate(DocumentEvent e) {
                        theTextPane.setCaretPosition(e.getOffset());
                   public void changedUpdate(DocumentEvent e) {}
                   class MyCompoundEdit extends CompoundEdit {
                        public boolean isInProgress() {
                             return false;
                        public void undo() throws CannotUndoException {
                             if (compoundEdit != null) compoundEdit.end();
                             super.undo();
                             compoundEdit = null;
              public Pane() {
                   theTextPane = new JTextPane();
                   theTextPane.setEditorKit(new StyledEditorKit() {
                        public Document createDefaultDocument() {
                             return new SyntaxDocument();
                   theUndoManager = new CompoundUndoManager();
                   theTextPane.getDocument().addUndoableEditListener(theUndoManager);
              public JTextPane getTextPane() {
                   return theTextPane;
              public UndoManager getUndoManager() {
                   return theUndoManager;
         public URTest() {
              super(new BorderLayout(5, 5));
              setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
              JToolBar toolBar = new JToolBar();
              toolBar.setFloatable(false);
              toolBar.add(new AbstractAction("Undo") {
                   public void actionPerformed(ActionEvent e) {
                        undo();
              toolBar.add(new AbstractAction("Redo") {
                   public void actionPerformed(ActionEvent e) {
                        redo();
              add(toolBar, BorderLayout.NORTH);
              thePanes = new LinkedList<Pane>();
              theTabbedPane = new JTabbedPane();
              add(theTabbedPane, BorderLayout.CENTER);
              theMenuBar = new JMenuBar();
              JMenu menu = new JMenu("File");
              menu.add(new AbstractAction("New") {
                   public void actionPerformed(ActionEvent e) {
                        create();
              menu.add(new AbstractAction("Close") {
                   public void actionPerformed(ActionEvent e) {
                        remove();
              theMenuBar.add(menu);
         public JMenuBar getMenuBar() {
              return theMenuBar;
         private void create() {
              Pane pane = new Pane();
              thePanes.add(pane);
              theTabbedPane.addTab("Tab", pane.getTextPane());
         private void remove() {
              Pane selectedPane = getSelectedPane();
              if (selectedPane == null) return;
              thePanes.remove(selectedPane);
              theTabbedPane.remove(selectedPane.getTextPane());
         private void undo() {
              Pane selectedPane = getSelectedPane();
              if (selectedPane == null) return;
              try {
                   selectedPane.getUndoManager().undo();
                   selectedPane.getTextPane().requestFocus();
              } catch (CannotUndoException ex) {
                   System.out.println("Unable to undo: " + ex);
         private void redo() {
              Pane selectedPane = getSelectedPane();
              if (selectedPane == null) return;
              try {
                   selectedPane.getUndoManager().redo();
                   selectedPane.getTextPane().requestFocus();
              } catch (CannotRedoException ex) {
                   System.out.println("Unable to redo: " + ex);
         private Pane getSelectedPane() {
              Component selectedComponent = theTabbedPane.getSelectedComponent();
              if (selectedComponent == null) return null;
              for (Pane pane : thePanes) {
                   if (pane.getTextPane() == selectedComponent) return pane;
              return null;
         private static void test() {
              JFrame f = new JFrame("URTest");
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              URTest urTest = new URTest();
              f.setContentPane(urTest);
              f.setJMenuBar(urTest.getMenuBar());
              f.setSize(400, 400);
              f.setLocationRelativeTo(null);
              f.setVisible(true);
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        test();
    }Hope it helps.

  • Undo,redo not working properly with JPopupMenu

    if i use JButton for undo ,redo it is working fine. but the same code is not
    working properly if i add it in JPopupMenu.
    what could be the problem.
    thanks

    what could be the problem.Your code is different or written incorrectly and since you didn't post any we can't help.
    [url http://java.sun.com/docs/books/tutorial/uiswing/misc/action.html]How to Use Actions
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • Undo/redo generate 'Save Changes to filename' pop up after 3 or 4 clicks.  Is there a way to turn this off?

    Running into issue with undo/redo(ctrl-z,ctrl-y) generating 'Save Changes to filename' pop up after 3 or 4 clicks.  Is there a way to turn this off?

    Sounds like some strange shortcut key conflict.
    The first thing to try is Deleting Corrupted Cache in DW.  Be sure hidden files & folders are enabled in Windows Explorer.
    http://forums.adobe.com/thread/494811
    If that doesn't help, try Restore Preferences
    http://helpx.adobe.com/dreamweaver/kb/restore-preferences-dreamweaver-cs4-cs5.html
    Nancy O.

  • Undo / Redo Feature in Swing

    Hi all,
    Iam working on swing project which uses Undo/Redo feature for drag and drop figure and delete,cut,copy,paste and all the feature which ever want to use, and iam using multiple internal frames so the feature Undo/Redo should be specific to perticular internal frame.
    Is any buddy already done such a kind of thing then pls help me, or if it's possible then pls send the code also.
    Regards
    Laxmikant

    Hi,
    you would have to create an UndoableEditListener for each object, undo/redo shall be perfomed. The listener then is connected to an instance of UndoManager to do the actual handling:  /** Listener for edits on a document. */
      private UndoableEditListener undoHandler = new UndoHandler();
      /** UndoManager that we add edits to. */
      private UndoManager undo = new UndoManager();
      /** inner class for handling undoable edit events */
      public class UndoHandler implements UndoableEditListener {
         * Messaged when the Document has created an edit, the edit is
         * added to <code>undo</code>, an instance of UndoManager.
        public void undoableEditHappened(UndoableEditEvent e) {
          undo.addEdit(e.getEdit());
      } This now can be registered with let's say a Document like thiseditor.getDocument().addUndoableEditListener(undoHandler); (editor is an instance of JEditorPane containing the document).
    Once you have this, you only need actions to perform undo or redo by calling the respective method of your instance of UndoManager undo() and redo().
    Hope that helps
    Ulrich

  • Undo/Redo for Cut, Copy, Paste

    I am trying to implement Undo/Redo for Cut,Copy,Paste in a Treetable.
    I have to support undo/redo for multiple nodes being cut/copied. I am not sure how I should be going about implementing this. Any help will be greatly appreciated.
    Thanks

    If the class you are using doesn't support cut, copy, and paste already, usually what you do is store a list of actions in two lists. One for actions done, the other for redos (when there is an undo). Capture the data before and after each operation (you can create a KeyListener to listen for the events) and store that in a list. When undo is called, the last element on the list should be undone, either by taking it out of the list and reiterating through the elements still there, or implementing an undo method in the object you are trying to change. Then put that element on the redo list in case that is called. This works well with graphics and stuff, but I never tried to implement it in a tree with nodes and stuff, so that's about the most I can help with right now. I hope it helps some!
    -JBoeing

  • Very slow Undo/Redo Process !

    Hi,
    Upgraded to Logic 10.1 yesterday, on a Brand new Mac Pro ( 2015 ), 32GB Memory, 1 TB SSD,
    Everything seems to be running smoothly, EXCEPT ...!!! ( Capital Letters )
    It's taking 15 seconds MINIMUM to Undo or Redo, Sometimes even a little longer !!
    What? Even simple MIDI operations, like delete One Midi note, to undo the process ( Commandl-Z ) it takes 15-16 seconds.
    On my Old macPro ( early 2008 ), I also did the update to LPX 10.1 and it is working fine, I am getting immediate Undo/Redo.
    I already tried all basic troubleshooting, anyone getting this bug? Any solutions?

    Macbook Pro 2011
    2.4 Ghz Quad i7
    8GB RAM
    500 GB SSD
    750 GB 5200 rpm hdd
    OSX 10.10.2
    Logic 10.1.0
    thanks!
    Joe
    Etrecheck Report...
    EtreCheck version: 2.1.8 (121)
    Report generated February 9, 2015 at 6:37:54 PM EST
    Download EtreCheck from http://etresoft.com/etrecheck
    Click the [Click for support] links for help with non-Apple products.
    Click the [Click for details] links for more information about that line.
    Click the [Adware! - Remove] links for help removing adware.
    Hardware Information: ℹ️
        MacBook Pro (15-inch, Late 2011) (Technical Specifications)
        MacBook Pro - model: MacBookPro8,2
        1 2.4 GHz Intel Core i7 CPU: 4-core
        8 GB RAM Upgradeable
            BANK 0/DIMM0
                4 GB DDR3 1333 MHz ok
            BANK 1/DIMM0
                4 GB DDR3 1333 MHz ok
        Bluetooth: Old - Handoff/Airdrop2 not supported
        Wireless:  en1: 802.11 a/b/g/n
        Battery Health: Normal - Cycle count 788
    Video Information: ℹ️
        Intel HD Graphics 3000 - VRAM: 512 MB
        AMD Radeon HD 6770M - VRAM: 1024 MB
            HP 27xi spdisplays_1080p
    System Software: ℹ️
        OS X 10.10.2 (14C109) - Time since boot: 2:32:26
    Disk Information: ℹ️
        M4-CT512M4SSD2 disk0 : (512.11 GB)
            EFI (disk0s1) <not mounted> : 210 MB
            Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
            JT SSD (disk2) / : 510.88 GB (126.68 GB free)
                Core Storage: disk0s2 511.25 GB Online
        TOSHIBA MK7559GSXF disk1 : (750.16 GB)
            EFI (disk1s1) <not mounted> : 210 MB
            DATA (disk1s2) /Volumes/DATA : 749.30 GB (107.62 GB free)
    USB Information: ℹ️
        Apple Inc. FaceTime HD Camera (Built-in)
        Apple Inc. Apple Internal Keyboard / Trackpad
        Apple Inc. BRCM2070 Hub
            Apple Inc. Bluetooth USB Host Controller
        Apple Computer, Inc. IR Receiver
        VIA Labs, Inc. USB3.0 Hub
        Seagate Backup+ Desk 3 TB
            EFI (disk4s1) <not mounted> : 315 MB
            MBProBkup (disk4s2) /Volumes/MBProBkup : 1.50 TB (70.13 GB free)
            JTBACKUP (disk4s3) /Volumes/JTBACKUP : 1.50 TB (615.33 GB free)
        Burr-Brown from TI USB audio CODEC
        Seagate FreeAgent FW 1 TB
            EFI (disk3s1) <not mounted> : 210 MB
            the archaeologist (disk3s2) /Volumes/the archaeologist : 999.86 GB (371.40 GB free)
        Focusrite A.E. Ltd Impulse
        Apple, Inc. Keyboard Hub
            iLok iLok
            Apple, Inc Apple Keyboard
    Thunderbolt Information: ℹ️
        Apple Inc. thunderbolt_bus
            StarTech.com Thunderbolt Laptop Dock
                Universal Audio, Inc. Apollo Twin
    Configuration files: ℹ️
        /etc/sysctl.conf - Exists
    Gatekeeper: ℹ️
        Anywhere
    Adware: ℹ️
        Geneio [Adware! - Remove]
    Kernel Extensions: ℹ️
            /Library/Extensions
        [not loaded]    com.apogee.driver.ApogeeUSBQuartetAudio (1.0.0a1 - SDK 10.8) [Click for support]
        [not loaded]    com.apogeedigital.kext.ApogeeUSBDuetAudio (1.0.0a1 - SDK 10.8) [Click for support]
        [not loaded]    com.caiaq.driver.NIUSBHardwareDriver (2.6.0 - SDK 10.8) [Click for support]
        [not loaded]    com.displaylink.dlusbncm (1.11.0 - SDK 10.9) [Click for support]
        [loaded]    com.displaylink.driver.DisplayLinkDriver (2.2 - SDK 10.9) [Click for support]
        [not loaded]    com.motu.driver.FireWireAudio (1.6 64254 - SDK 10.4) [Click for support]
        [not loaded]    com.motu.driver.MicroBookAudio (1.6 64254 - SDK 10.4) [Click for support]
        [not loaded]    com.motu.driver.PCIAudio (1.6 64254 - SDK 10.4) [Click for support]
        [not loaded]    com.motu.driver.USBMidiKext (1.6 64254 - SDK 10.4) [Click for support]
        [not loaded]    jp.co.roland.RDUSB0145Dev (1.0.1 - SDK 10.9) [Click for support]
            /System/Library/Extensions
        [loaded]    com.Cycling74.driver.Soundflower (1.6.6 - SDK 10.6) [Click for support]
        [not loaded]    com.RME.driver.FirefaceAudioDriver (3.16 - SDK 10.5) [Click for support]
        [not loaded]    com.caiaq.driver.NIUSBGuitarRigMobileDriver (2.4.23) [Click for support]
        [not loaded]    com.jft.driver.PdaNetDrv (1.0.0d1) [Click for support]
        [not loaded]    com.m-audio.driver.firewire (1.10.5) [Click for support]
        [not loaded]    com.m-audio.driver.firewire.dice (2.4.2 - SDK 10.6) [Click for support]
        [not loaded]    com.m-audio.usb.midisupport.driver (1.1) [Click for support]
        [not loaded]    com.paceap.kext.pacesupport.master (5.9.1 - SDK 10.6) [Click for support]
        [loaded]    com.uaudio.driver.UAD2System (7.11.1 - SDK 10.6) [Click for support]
        [not loaded]    com.xxxchurch.x3nke (1.0.0) [Click for support]
        [not loaded]    jp.co.roland.RDUSB0033Dev (1.0.0) [Click for support]
        [not loaded]    jp.co.roland.RDUSB010FDev (1.0.0 - SDK 10.6) [Click for support]
            /System/Library/Extensions/PACESupportFamily.kext/Contents/PlugIns
        [not loaded]    com.paceap.kext.pacesupport.leopard (5.9.1 - SDK 10.4) [Click for support]
        [not loaded]    com.paceap.kext.pacesupport.panther (5.9.1 - SDK 10.-1) [Click for support]
        [loaded]    com.paceap.kext.pacesupport.snowleopard (5.9.1 - SDK 10.6) [Click for support]
        [not loaded]    com.paceap.kext.pacesupport.tiger (5.9.1 - SDK 10.4) [Click for support]
    Startup Items: ℹ️
        DigidesignLoader: Path: /Library/StartupItems/DigidesignLoader
        M-Audio FireWire Audio Helper: Path: /Library/StartupItems/M-Audio FireWire Audio Helper
        M-Audio Firmware Loader: Path: /Library/StartupItems/M-Audio Firmware Loader
        RDUSB0145Startup: Path: /Library/StartupItems/RDUSB0145Startup
        Startup items are obsolete in OS X Yosemite
    Launch Agents: ℹ️
        [running]    com.ApogeePopup.plist [Click for support]
        [not loaded]    com.displaylink.useragent-prelogin.plist [Click for support]
        [running]    com.displaylink.useragent.plist [Click for support]
        [running]    com.eastwest.server.plist [Click for support]
        [running]    com.maudio.profire.helper.plist [Click for support]
        [running]    com.motu.MOTULauncher.plist [Click for support]
        [loaded]    com.oracle.java.Java-Updater.plist [Click for support]
        [running]    de.rme-audio.firefaceAgent.plist [Click for support]
        [running]    touchAbleServer.plist [Click for support]
    Launch Daemons: ℹ️
        [loaded]    com.adobe.fpsaud.plist [Click for support]
        [loaded]    com.avid.bsd.DigiShoeTool.plist [Click for support]
        [loaded]    com.avid.bsd.ShoeTool.plist [Click for support]
        [running]    com.displaylink.displaylinkmanager.plist [Click for support]
        [running]    com.DuetUSBDaemon.plist [Click for support]
        [loaded]    com.gobbler.bsd.HelperTool.plist [Click for support]
        [loaded]    com.gobbler.DownstreamProxy.plist [Click for support]
        [running]    com.m-audio.firewire.helper.plist [Click for support]
        [loaded]    com.novation.automap.pluginhelper.plist [Click for support]
        [loaded]    com.oracle.java.Helper-Tool.plist [Click for support]
        [loaded]    com.oracle.java.JavaUpdateHelper.plist [Click for support]
        [running]    com.paceap.eden.licensed.plist [Click for support]
        [running]    com.QuartetDaemon.plist [Click for support]
        [failed]    com.x3.x3daemon.plist [Click for support] [Click for details]
        [loaded]    org.cindori.TEAuth.plist [Click for support]
        [loaded]    PACESupport.plist [Click for support]
    User Launch Agents: ℹ️
        [failed]    com.amazon.cloud-player.plist [Click for support] [Click for details]
        [running]    com.amazon.music.plist [Click for support]
        [loaded]    com.genieo.completer.download.plist [Adware! - Remove]
        [loaded]    com.genieo.completer.ltvbit.plist [Adware! - Remove]
        [running]    com.genieo.completer.update.plist [Adware! - Remove]
        [loaded]    com.google.keystone.agent.plist [Click for support]
        [running]    com.spotify.webhelper.plist [Click for support]
    User Login Items: ℹ️
        gfxCardStatus    UNKNOWN  (missing value)
        iTunesHelper    UNKNOWN Hidden (missing value)
        EvernoteHelper    UNKNOWN  (missing value)
        EvernoteHelper    UNKNOWN  (missing value)
        EEventManager    Application Hidden (/Applications/Epson Software/Event Manager.app/Contents/Resources/Assistants/Event Manager/EEventManager.app)
        SafeEyes    UNKNOWN  (missing value)
        TuneupMyMac    UNKNOWN  (missing value)
        Gobbler2    UNKNOWN  (missing value)
        UA Mixer Engine    Application  (/Library/Application Support/Universal Audio/Apollo/UA Mixer Engine.app)
        NIHardwareAgent    Application Hidden (/Library/Application Support/Native Instruments/Hardware/NIHardwareAgent.app)
        EEventManager    Application  (/Applications/Epson Software/Event Manager.app/Contents/Resources/Assistants/Event Manager/EEventManager.app)
    Internet Plug-ins: ℹ️
        AmazonMP3DownloaderPlugin1017277: Version: AmazonMP3DownloaderPlugin 1.0.17 [Click for support]
        Unity Web Player: Version: UnityPlayer version 3.3.0f4 [Click for support]
        Default Browser: Version: 600 - SDK 10.10
        iLokClientHelper: Version: 3.6 - SDK 10.5 [Click for support]
        QuakeLivePlugin: Version: 0.1.0.277 [Click for support]
        Silverlight: Version: 5.1.30514.0 - SDK 10.6 [Click for support]
        FlashPlayer-10.6: Version: 16.0.0.305 - SDK 10.6 [Click for support]
        DivXBrowserPlugin: Version: 1.4 [Click for support]
        WidevineMediaOptimizer: Version: 6.0.0.12757 - SDK 10.7 [Click for support]
        Flash Player: Version: 16.0.0.305 - SDK 10.6 [Click for support]
        QuickTime Plugin: Version: 7.7.3
        iPhotoPhotocast: Version: 7.0
        WidevineMediaTransformer: Version: Unknown [Click for support]
        AdobePDFViewer: Version: 9.3.3 [Click for support]
        JavaAppletPlugin: Version: Java 8 Update 31 Check version
    User internet Plug-ins: ℹ️
        VusionWARPVideo: Version: 1.6.0 [Click for support]
        Move_Media_Player: Version: npmnqmp 071503000004 [Click for support]
        BrowserPlus_2.9.8: Version: 2.9.8 [Click for support]
        iGetterScriptablePlugin: Version: 2.9.2 [Click for support]
    Audio Plug-ins: ℹ️
        DVCPROHDAudio: Version: 1.3.2
    3rd Party Preference Panes: ℹ️
        Flash Player  [Click for support]
        Java  [Click for support]
        Native Instruments USB Audio  [Click for support]
        SPD-SX  [Click for support]
    Time Machine: ℹ️
        Skip System Files: NO
        Mobile backups: OFF
        Auto backup: NO - Auto backup turned off
        Volumes being backed up:
            JT SSD: Disk size: 510.88 GB Disk used: 384.19 GB
        Destinations:
            MBProBkup [Local]
            Total size: 1.50 TB
            Total number of backups: 34
            Oldest backup: 2014-11-04 00:04:04 +0000
            Last backup: 2015-02-06 21:56:19 +0000
            Size of backup disk: Adequate
                Backup size 1.50 TB > (Disk used 384.19 GB X 3)
    Top Processes by CPU: ℹ️
            76%    Logic Pro X
             9%    coreaudiod
             3%    UA Mixer Engine
             3%    WindowServer
             3%    AutomapServer
    Top Processes by Memory: ℹ️
        1.86 GB    Logic Pro X
        172 MB    mds_stores
        120 MB    WindowServer
        94 MB    Finder
        77 MB    com.apple.WebKit.WebContent
    Virtual Memory Information: ℹ️
        1.96 GB    Free RAM
        3.50 GB    Active RAM
        1.61 GB    Inactive RAM
        1.51 GB    Wired RAM
        2.28 GB    Page-ins
        0 B    Page-outs
    Diagnostics Information: ℹ️
        Feb 9, 2015, 06:35:34 PM    /Library/Logs/DiagnosticReports/Logic Pro X_2015-02-09-183534_[redacted].hang
        Feb 9, 2015, 04:05:02 PM    Self test - passed
        Feb 9, 2015, 11:53:32 AM    /Library/Logs/DiagnosticReports/Logic Pro X_2015-02-09-115332_[redacted].cpu_resource.diag [Click for details]
        Feb 9, 2015, 09:56:58 AM    /Library/Logs/DiagnosticReports/Logic Pro X_2015-02-09-095658_[redacted].cpu_resource.diag [Click for details]
        Feb 6, 2015, 07:14:11 PM    /Library/Logs/DiagnosticReports/Logic Pro X_2015-02-06-191411_[redacted].cpu_resource.diag [Click for details]
        Feb 6, 2015, 07:10:34 PM    /Users/[redacted]/Library/Logs/DiagnosticReports/AutomapServer_2015-02-06-19103 4_[redacted].crash

  • Move OSD of Undo/Redo to bottom of workspace

    A lot of the time when I am trying to compare one particular edit that I've made, say, increase Vibrance +30, I switch back and forth using Undo/Redo to view the Before/After (using the '\' key to see 'Before' vs 'After' doesn't work if you've already made multiple edits, obviously).
    Now, I like how LR shows 'Undo Vibrance + 30' in big bold letters across the screen, BUT, could you please move it *away* from smack dab right in the center on top of my image?
    If you moved the On-Screen-Display of 'Undo/Redo' actions to near the bottom of the LR workspace, it wouldn't interfere with my viewing of what's happening to the image.
    Seems simple + logical enough.
    Thanks,
    Rishi

    I approach it differently :
    When (or if) I get an image to a point where I want to compare small changes I make a virtual copy and then adjust the VC, then using the '\' key to see 'Before' vs 'After' does work.
    Not a work around - a different way of working.
    Sid
    The LightroomExtra home page is right here.

Maybe you are looking for