mb2297
asked on
How does an applet behave when reloaded?
Hello experts,
I already have an open question in this vein, but I wanted to ask something more general here to help my understanding of the issue.
My Applet is part of a drawing tool, and it loads in an image to be drawn on from a URL. The JPanel that the image sits in automatically resizes itself when an image is loaded in. The problem I'm having is when the Applet is reloaded with a different image. When this happens, there are a couple of problems:
1. The JPanel for the image remains the same size, essentially cropping a larger image.
2. Whatever items were drawn onto the first image remain when the Applet is reloaded with a different image.
So it looks like the Objects created in the first load remain after the reload. Why is this? Is there a way to stop it happening?
Thanks,
Matt.
I already have an open question in this vein, but I wanted to ask something more general here to help my understanding of the issue.
My Applet is part of a drawing tool, and it loads in an image to be drawn on from a URL. The JPanel that the image sits in automatically resizes itself when an image is loaded in. The problem I'm having is when the Applet is reloaded with a different image. When this happens, there are a couple of problems:
1. The JPanel for the image remains the same size, essentially cropping a larger image.
2. Whatever items were drawn onto the first image remain when the Applet is reloaded with a different image.
So it looks like the Objects created in the first load remain after the reload. Why is this? Is there a way to stop it happening?
Thanks,
Matt.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the clear explanation Tomas. Those links were very useful.
Matt.
Matt.
2. again the painting isimplemented in your applet, so if the applet is reloaded you need to clear anything that you are already painting. This can be implemnted in the start() method as I mentioned in your other q. The start() method will get called whenever the applet is loaded.