Package javax.swing.undo

Examples of javax.swing.undo.UndoManager.undo()


      // Create an undo button
      this.undoButton = new JButton(new ImageIcon(
          getClass().getResource("resources/Undo16.gif")));
      this.undoButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
          undoManager.undo();
        }
      });
      // Create a redo button
      this.redoButton = new JButton(new ImageIcon(
          getClass().getResource("resources/Redo16.gif")));
View Full Code Here


    // Check the wall didn't move at end
    assertCoordinatesEqualWallPoints(20, 20, 504, 20, wall1);

    // 10. Undo 8 times
    for (int i = 0; i < 6; i++) {
      undoManager.undo();
    }
    // Check home doesn't contain any wall
    assertHomeContains(home);
   
    // 11. Redo 8 times
View Full Code Here

    am.put("Undo", new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {
        try {
          if (undoManager.canUndo()) {
            undoManager.undo();
          }
        } catch (CannotUndoException exp) {
          exp.printStackTrace();
        }
      }
View Full Code Here

            private static final long serialVersionUID = -2135822508998640523L;

                public void actionPerformed(ActionEvent e) {
                    try {
                        if (undoManager.canUndo()) {
                            undoManager.undo();
                        }
                    }
                    catch (CannotUndoException ex) {
                    }
                }
View Full Code Here

    try{
      // This "while" should roll multiple adds or deletes into one.
      //System.out.println(undoStyle);
      //System.out.println(undoMgr.getUndoPresentationName());
      while(undoStyle.equals(undoMgr.getUndoPresentationName()))
        undoMgr.undo();
    }catch(CannotUndoException ex){
      //JOptionPane.showMessageDialog(this, lang.getString("MSG_NOTHING_TO_UNDO"), "No change" , JOptionPane.INFORMATION_MESSAGE);
    }
    updateWindowTitle();
    updateUndoRedoMenuState();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.