File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
Reg. Applet
applet LoadAGif can't start: error????
Simple Thread with image..
applet LoadAGif can't start: error????
Help with paint to panel