wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes UndoManager Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "UndoManager Help" Watch "UndoManager Help" New topic
Author

UndoManager Help

Anand Loni
Ranch Hand

Joined: Jan 20, 2006
Posts: 150
Hello,

I am using undoManager for Textfield. I have Popup menu associated with textfield. When I click undo from poppup menu single character from textfield is undone. How can I undo all characters that I have typed before undo.

Hoping for reply...


~ Anand,
SCJP 1.5, SCWCD 1.5
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I wanted my code to behave more like some well-known text editors, where when you type "abcd" and then hit undo, all four letters disappear from the screen. The requirements are more complex than that, if you look carefully, but this is what I came up with:This is in a class that extends UndoManager, by the way. There's some constants and instance variables you need in this class:and the ExpandableEdit class is like this:I chopped this out of working code, hopefully I haven't missed out too much and you can get started with this.
Anand Loni
Ranch Hand

Joined: Jan 20, 2006
Posts: 150
Hi Paul,

Thanks a lot...
The code is working fine....
 
Consider Paul's rocket mass heater.
 
subject: UndoManager Help