wood burning stoves 2.0*
The moose likes Applets and the fly likes Display Image in an Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Display Image in an Applet" Watch "Display Image in an Applet" New topic
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display Image in an Applet
 
Similar Threads
applet LoadAGif can't start: error????
Help with paint to panel
Simple Thread with image..
Reg. Applet
applet LoadAGif can't start: error????