| Author |
Display Image in an Applet
|
Rohan Pujari
Greenhorn
Joined: Feb 27, 2007
Posts: 24
|
|
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?
|
 |
Craig Wood
Ranch Hand
Joined: Jan 14, 2004
Posts: 1535
|
|
|
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.
|
 |
 |
|
|
subject: Display Image in an Applet
|
|
|