WHEN I LOAD THE APPLET THE IMAGE IS NOT DISPLAYED BUT THE MOMENT I RESIZE THE APPLET THE IMAGE IS DISPLAYED WHY IS THIS SO?
posted 8 years ago
Because the getImage method creates an instance of Image but does not actually load the image data into the jvm. You cannot draw the image if there is no data to draw. To load the data when using Toolkit methods use a MediaTracker. See the MediaTracker class api comments section for example code that shows how to do this. If you are using java version 1.4 or later you can use the ImageIO class to load images. It is easier. The Swing FAQ has an example.