Package javax.swing.text

Examples of javax.swing.text.Document.addUndoableEditListener()


                    doc.removeUndoableEditListener(getUndoableEditListener());
                }

                doc = (Document)evt.getNewValue();
                if (doc != null) {
                    doc.addUndoableEditListener(getUndoableEditListener());
                }
            }
        }

    }
View Full Code Here


        }
       
        Document doc = pane.getDocument();
       
        // Listen for undo and redo events
        doc.addUndoableEditListener(new UndoableEditListener() {
            public void undoableEditHappened(UndoableEditEvent evt) {
                if (isUndoable()) {
                    undomanager.addEdit(evt.getEdit());
                }
            }
View Full Code Here

   
    /** Creates new form WikiEditorPanel */
    public WikiEditorPanel() {
        initComponents();
        Document doc = jTextWiki.getDocument();
        doc.addUndoableEditListener(new MyUndoableEditListener());
        jButtonUndo.setAction(undoAction);
        jButtonRedo.setAction(redoAction);
       
    }
   
View Full Code Here

  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());
      }
View Full Code Here

  void InitializeUndo() {

    // Taken from
    // http://www.java2s.com/Tutorial/Java/0240__Swing/AddingUndoandRedotoaTextComponent.htm
    Document doc = jTextArea1.getDocument();
    doc.addUndoableEditListener(new UndoableEditListener() {
        public void undoableEditHappened(UndoableEditEvent evt) {
            undo.addEdit(evt.getEdit());
        }
    });
View Full Code Here

        editMenu.addSeparator();
        editMenu.add(getActionByName(DefaultEditorKit.selectAllAction));
        
        final Document d = textPane.getDocument();
        d.addUndoableEditListener(new MyUndoableEditListener());
        d.addDocumentListener(new DocumentListener() {
            public void changedUpdate(DocumentEvent evt) { update(); }
            public void insertUpdate(DocumentEvent evt) { update(); }
            public void removeUpdate(DocumentEvent evt) { update(); }
            private void update() { countLabel.setText("Characters: " + d.getLength()); }
View Full Code Here

   if (cb1 != null) {
      tfld.addActionListener(cb1);
      tfld.addFocusListener(new TextUnfocus(lbl,cb1));
    }
   if (cb2 != null) doc.addUndoableEditListener(cb2);

   addGBComponent(tfld,1,y_count++,0,1,10,0);

   tag_map.put(tfld,lbl);
   tag_map.put(doc,lbl);
View Full Code Here

   addGBComponent(tag,0,y_count,1,1,0,0);

   JTextArea tarea = new JTextArea(val,row,col);
   Document doc = tarea.getDocument();

   if (cb != null) doc.addUndoableEditListener(cb);

   addGBComponent(new JScrollPane(tarea),1,y_count++,0,1,10,10);

   tarea.setBorder(new LineBorder(SwingColors.SWING_DARK_COLOR));
View Full Code Here

   if (cb1 != null) {
      tfld.addActionListener(cb1);
      tfld.addFocusListener(new TextUnfocus(lbl,cb1));
    }

   if (cb2 != null) doc.addUndoableEditListener(cb2);

   if (cb3 != null) tfld.addCaretListener(cb3);

   addGBComponent(tfld,1,y_count,1,1,10,0);
View Full Code Here

    final int redoKey   = isMacOS ? KeyEvent.VK_Z : KeyEvent.VK_Y;
    final int redoMod    = isMacOS ? meta | InputEvent.SHIFT_MASK : meta;
     imap.put( KeyStroke.getKeyStroke( redoKey, redoMod ), "redo" );

     final Document doc = getDocument();
     doc.addUndoableEditListener( this );
    
     // create default tabs
    tabs = new TabStop[ 30 ];
    for( int i = 0; i < 30; i++ ) {
      tabs[ i ] = new TabStop( i * 28 );
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.