|
|
||||
|
||||
|
|
||||
|
||||
|
|
|
|
||||
|
||||
|
|
||||
|
||||
|
|
Code Barn Load A Gif | |
Explanation of LoadAGif applet Number of files: 2 (LoadAGif.class, and a .gif file named horsenav.gif) What it does: Displays an .gif image in an applet. The image is fully downloaded before being displayed. How to display a gif file in an applet:
You may skip steps 2, 3 and 4 if you don't mind that the paint() method will attempt to draw the image before it is fully downloaded. A JavaDoc:java.awt.MediaTracker is just what the name suggests -- an object whose job is to track the download status of media elements. Sadly, it was implemented only for Images. Originally, it was designed to allow adding other media, such as audio files. So a more realistic name would be ImageTracker : (
You can do more sophisticated status-checking with MediaTracker, to implement a status bar, for example.
Code
CodeBarnApplets | |