File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Drawing Graphics in Applet in Layers?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Reply locked New topic

Drawing Graphics in Applet in Layers??

Ivn Tcakov

Joined: Oct 15, 2003
Posts: 9
I have a tricky question, where I am not sure if java would supprot what I need.
I am drawing grahps using Graphics in a class that exdends Applet.
I would like to be able to draw two different things on the same 'canvas' without overwriting one another. Something that comes to mind as analogy is Layers but I couldn't find if Graphics has this or similar feature.
Basically, right now, if I want to draw something new on the canvas, I have to erase (owervrite) what was there before but I don't want to do that. I want to be able to add something on top of the old graphic and then later remove what I had drawn on top and still have the old graphic be there intact.
Any suggestions if this is possible and if yes, how I can do that?
(I am using Graphics methods such as: g.drawString, g.drawLine, g.drawLine etc.)
Help appreciated,
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Please do not cross post questions. I am leaving the one in the Swing forum open as this question is more specific to AWT/Swing Layers and has less to do with Applets. This post will be closed. Please continue this discussion here.

GenRocket - Experts at Building Test Data
I agree. Here's the link:
subject: Drawing Graphics in Applet in Layers??
It's not a secret anymore!