Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1838
| From | "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Prevent Undo/Redo |
| Message-ID | <1181844596.371558.108860@d30g2000prg.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| Date | 2011-04-27 15:35 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui,comp.l Hello, I am adding Undo/Redo to JTextFields in the GUI portion of my application. It's relatively simple to do as in this case... nameTextField.getDocument().addUndoableEditListener(project.getUndoManager()); Every project has an UndoManager. When I open up a new property window, I add the UndoManager as a listener to the documents of various text fields. This works well. The problem I am having is twofold (although I believe its related to the same issue). 1. Items are added to the UndoManager whenever ANY change is made to the text field. Is there any way to prevent this from happening when I don't want it to happen? My reasoning for this is I populate the text fields AFTER the UndoEditListener has been added to the text field, so, because of this, the UndoManager automatically starts off with edits on the stack. 2. I can potentially have multiple views to the same object. If I edit one field, it should also update in the other view. The problem is that this really seems to mess up the UndoManager. Again, I think this is related to the issue above, but I am really not sure where to begin to fix something like this. Any suggestions or help that you can provide would be much appreciated. Thanks! --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next | Find similar | Unroll thread
Prevent Undo/Redo "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
csiph-web