Package javax.swing.undo

Examples of javax.swing.undo.UndoManager


      }
    });
    UtilGUI.monitorWindowPosition(theFrame, prefsNode);

    ta = new JTextArea(30,70);
    undoManager = new UndoManager();
    final Document document = ta.getDocument();
    document.addUndoableEditListener(undoManager);
    // all change methods set dirty = true;
    document.addDocumentListener(new DocumentListener() {
      public void changedUpdate(DocumentEvent e) {
View Full Code Here


        handleCaretPositionChange(ce);
      }
    });

    /* Set up the undo features */
    undoMngr = new UndoManager();
    undoAction = new UndoAction();
    redoAction = new RedoAction();
    jtpMain.getDocument().addUndoableEditListener(new CustomUndoableEditListener());

    /* Insert raw document, if exists */
 
View Full Code Here

    public void setLastSecondaryButton(JComponent lastSecondaryButton) {
        this.lastSecondaryButton = lastSecondaryButton;
    }

    public void updateUndoRedoControls() {
        UndoManager undoManager = renderPanel.getUndoManager();
        JButton redoButton=buttons.get("redo");
        JButton undoButton=buttons.get("undo");
        if (undoManager.canRedo()) {
            redoButton.setEnabled(true);
            redoMenu.setEnabled(true);
            redoButton.setToolTipText(GT.get("Redo")+": "+undoManager.getRedoPresentationName());
        } else {
            redoButton.setEnabled(false);
            redoMenu.setEnabled(false);
            redoButton.setToolTipText(GT.get("No redo possible"));
        }

        if (undoManager.canUndo()) {
            undoButton.setEnabled(true);
            undoMenu.setEnabled(true);
            undoButton.setToolTipText(GT.get("Undo")+": "+undoManager.getUndoPresentationName());
        } else {
            undoButton.setEnabled(false);
            undoMenu.setEnabled(false);
            undoButton.setToolTipText(GT.get("No undo possible"));
        }
View Full Code Here

    if(theJreepad.canWeUndo())
      theJreepad.undoAction();
    else
      JOptionPane.showMessageDialog(this, lang.getString("MSG_NOTHING_TO_UNDO"), "No change" , JOptionPane.INFORMATION_MESSAGE);
*/
    UndoManager undoMgr = theJreepad.getCurrentNode().getArticle().getUndoMgr();
    String undoStyle = undoMgr.getUndoPresentationName();
    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

    }
    updateWindowTitle();
    updateUndoRedoMenuState();
  }
  private void redoAction(){
    UndoManager undoMgr = theJreepad.getCurrentNode().getArticle().getUndoMgr();
    String redoStyle = undoMgr.getRedoPresentationName();
    try{
      while(redoStyle.equals(undoMgr.getRedoPresentationName()))
        undoMgr.redo();
    }catch(CannotRedoException ex){
      //JOptionPane.showMessageDialog(this, lang.getString("MSG_NOTHING_TO_UNDO"), "No change" , JOptionPane.INFORMATION_MESSAGE);
    }
    updateWindowTitle();
    updateUndoRedoMenuState();
View Full Code Here

            this.title = UNTITLED_NODE_TEXT;
        else
            this.title = title;
        this.content = content;
        this.articleMode = articleMode;
        undoMgr = new UndoManager();
    }
View Full Code Here

  private JMenuItem undoMenu;
  private JMenuItem redoMenu;
  private static UndoRedoManager instance;

  private UndoRedoManager() {
    undoManager = new UndoManager();
    undoManager.setLimit(15);
  }
View Full Code Here

TOP

Related Classes of javax.swing.undo.UndoManager

Copyright © 2018 www.massapicom. 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.