This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes how to undo the last action printed on an applet using undo button Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "how to undo the last action printed on an applet using undo button" Watch "how to undo the last action printed on an applet using undo button" New topic
Author

how to undo the last action printed on an applet using undo button

srinivas bolloju
Ranch Hand

Joined: Jan 23, 2001
Posts: 112
hi,
how to undo the last action printed on an applet using undo button....
im having an applet in which i can draw some lines,draw some rectangle's etc, using some buttons. i want to introduce a new button in my applet "undo". the function of this button is ,when clicked it will undo the (erase) lact action performed.
can anybody help me how to do this "undo" functionality?


please use the [code][/code] tags when showing code. visit <a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=ubb_code_page" target="_blank" rel="nofollow">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=ubb_code_page</a> ,for more details
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Srinivas,
The example below might help you out.

The important line is show in bold.
Regards,
Manfred.
Daniel Searson
Ranch Hand

Joined: Dec 03, 2000
Posts: 83
Draw all of your shapes etc. onto a BufferedImage or an offscreen Image created using the method in the Panel class. Before you draw anything onto the image, draw a copy of the image onto another offscreen image or BufferedImage. When the user hits Undo, simply revert to the last image copy that was made.
This is easily done with BufferedImage - take a look at the documentation for the API.
Hope that helps.


- Daniel
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: how to undo the last action printed on an applet using undo button
 
Similar Threads
maintain action history of drag and drop in jtree
print applet
JBoss Jax-ws Timeout Configuration
Memento Vs Command pattern
how to undo the last action printed on an applet using undo button