Examples of addUndoableEditListener()


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

  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

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

        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

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

   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

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

   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

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

   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

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

    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

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

        }
               
        // re-register new
        final Document newDoc = (Document) pce.getNewValue();
        if( newDoc != null ) {
          newDoc.addUndoableEditListener( TextView.this );
          for( int i = 0; i < collDocListeners.size(); i++ ) {
            newDoc.addDocumentListener( (DocumentListener) collDocListeners.get( i ));
//System.out.println( "add " + collDocListeners.get( i ));
          }
          if( newDoc instanceof AbstractDocument ) {
View Full Code Here

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

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

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

        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

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

          d.addDocumentListener(listener);
        }

        @Override
        public void addUndoableEditListener(UndoableEditListener listener) {
          d.addUndoableEditListener(listener);
        }

        @Override
        public Position createPosition(int offs) throws BadLocationException {
          return d.createPosition(offs);
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.