• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Srinivas,
The example below might help you out.

The important line is show in bold.
Regards,
Manfred.
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic