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?