Package javax.swing.undo

Examples of javax.swing.undo.UndoManager


  public void ActivaHojaListener(){
    Editor.getHoja().addCaretListener(this);
  }
 
  public ToolPanel(Editor Ed){
    undoManager = new UndoManager();
    centro = new JPanel();
    Acciones = a.getActionMap();
    accionCopiar = Acciones.get(DefaultEditorKit.copyAction);
    accionCortar = Acciones.get(DefaultEditorKit.cutAction);
    accionPegar = Acciones.get(DefaultEditorKit.pasteAction);
View Full Code Here


   * Constructor.
   * @param aShell the application shell
   */
  public ApplicationState(ApplicationShell aShell) {
    shell = aShell;
    undoManager = new UndoManager();
    appCommandDispatcher = new ApplicationCommandDispatcher(this);
    editorDispatcher = new EditorCommandDispatcher(shell);
    shell.getContentPane().add(createEditorArea(), BorderLayout.CENTER);
    editorFactory = new EditorFactory(shell, this, tabbedPane);
    installMainToolbar();
View Full Code Here

public class FieldText extends JTextArea{
  private UndoManager undoManager;

  public FieldText() {
    super();
    undoManager = new UndoManager();
    undoManager.setLimit(50);

    setLineWrap(true);
    setWrapStyleWord(true);
    setFont(new java.awt.Font("Courier new", 0, 12));
View Full Code Here

   private final RedoAction mRA;
  
   public UndoThing()
   {
      super();
      mUndo = new UndoManager();
      mUA = new UndoAction();
      mRA = new RedoAction();
   }
View Full Code Here

            case ItemEvent.DESELECTED:
                deselectedItem = e.getItem();
                break;
            case ItemEvent.SELECTED:

                UndoManager undoManager = Application.getInstance().getUndoManager();
                undoManager.addEdit(new JComboBoxUndoableEdit(
                        (JComboBox) e.getSource(),
                        deselectedItem,
                        e.getItem(),
                        this));
View Full Code Here

    return btnReparse.isEnabled();
  }

  private void makeUndoable(JTextComponent textComponent) {
    // code from: http://stackoverflow.com/a/12030993
    final UndoManager undoManager = new UndoManager();
    Document doc = textComponent.getDocument();
    doc.addUndoableEditListener(new UndoableEditListener() {
      @Override
      public void undoableEditHappened(UndoableEditEvent e) {
        //System.out.println("Add edit");
        undoManager.addEdit(e.getEdit());
      }
    });

    InputMap im = textComponent.getInputMap(JComponent.WHEN_FOCUSED);
    ActionMap am = textComponent.getActionMap();

    im.put(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "Undo");
    im.put(KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "Redo");

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

        // Create a javax.swing.undo.UndoManager; this is an amazing class that
        // keeps a Stack of UndoableEdits and lets you invoke them;
        // by registering it as a Listener on the TextComponent.Document,
        // the Document will create the UndoableEdit objects and send them
        // to the UndoManager. Between them they do ALL the work!
        um = new UndoManager();
        ta.getDocument().addUndoableEditListener(um);

        // Create the buttons
        JButton cutButton, copyButton, pasteButton, undoButton, redoButton;
        bp.add(cutButton = new JButton("Cut"));
View Full Code Here

public class FieldText extends JTextArea{
  private UndoManager undoManager;

  public FieldText() {
    super();
    undoManager = new UndoManager();
    undoManager.setLimit(50);

    setLineWrap(true);
    setWrapStyleWord(true);
    setFont(new java.awt.Font("Courier new", 0, 12));
View Full Code Here

    /** Creates new form AudioPanel */
    public AudioPanel() {
        initComponents();
        scaleRatio = 1;
        toolMode = 0;
        undo = new UndoManager();
        fileName = "";
        fileType = null;
        highlight = null;
        toolColor = Color.BLACK;
        selectionColor = Color.YELLOW;
View Full Code Here

     * The installed shortcuts are active when <code>root</code> contains the current focus owner.
     *
     */
    public InputPanelUndoRedoEnabler(InputPanel panel, JComponent root) {
        this.panel = panel;
        this.undoManager = new UndoManager();
        this.bindings = installKeyBindings(root);
        panel.setSendUndoEvents(true);
        panel.addUndoableEditListener(undoManager);
    }
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.