The MediaTracker class assists in the loading of multimedia objects across the network. It can be used to wait until an object (or group of objects) has been loaded completely. Tracked objects are assigned to groups; if there is more than one object in a group, you can only track the behavior of the group as a whole (i.e., it isn't possible to track an individual object unless it is the only object in its group). Currently (1.0.2 and 1.1) MediaTracker only works for Image objects; future releases may extend MediaTracker to other multi-media types.
public abstract class java.awt.MediaTracker extends java.lang.Object implements java.io.Serializable { // Constants public static final int ABORTED; public static final int COMPLETE; public static final int ERRORED; public static final int LOADING; // Constructors public MediaTracker (Component component); // Instance Methods public void addImage (Image image, int id); public synchronized void addImage (Image image, int id, int width, int height); public boolean checkAll(); public synchronized boolean checkAll (boolean load); public boolean checkID (int id); public synchronized boolean checkID (int id, boolean load); public synchronized Object[] getErrorsAny(); public synchronized Object[] getErrorsID (int id); public synchronized boolean isErrorAny(); public synchronized boolean isErrorID (int id); public synchronized void removeImage(Image image); public synchronized void removeImage(Image image, int id); public synchronized void removeImage(Image image, int id, int width, int height); public synchronized int statusAll (boolean load); public synchronized int statusID (int id, boolean load); public void waitForAll() throws InterruptedException; public synchronized boolean waitForAll (long ms) throws InterruptedException; public void waitForID (int id) throws InterruptedException; public synchronized boolean waitForID (int id, long ms) throws InterruptedException; }
Flag that indicates that the loading process aborted while loading a particular image.
Flag that indicates a particular image loaded successfully.
Flag that indicates an error occurred while a particular image was loading.
Flag that indicates a particular image is still loading.
Component that eventually renders objects being tracked.
Constructs an MediaTracker object.
Image to track.
ID of a group.
Tells a MediaTracker to track the loading of image, placing the image in the group identified by id.
Image to track.
ID of a group.
Eventual rendering width.
Eventual rendering height.
Tells a MediaTracker to track the loading of image, which will be scaled to the given height and width, placing the image in the group identified by id.
true if images completed loading (successfully or unsuccessfully), false otherwise.
Determines if all images have finished loading.
Flag to force image loading to start.
true if all images have completed loading (successfully or unsuccessfully), false otherwise.
Determines if all images have finished loading; the load parameter may be used to force images to start loading.
ID of a group.
true if all images have completed loading (successfully or unsuccessfully), false otherwise.
Determines if all images with the given ID tag have finished loading.
ID of a group.
Flag to force image loading to start.
true if all images have completed loading (successfully or unsuccessfully), false otherwise.
Determines if all images with the given ID tag have finished loading; the load parameter may be used to force images to start loading.
An array of objects managed by this media tracker that encountered a loading error.
Checks to see if any media encountered an error while loading.
ID of a group.
An array of objects that encountered a loading error.
Checks to see if any media with the given ID tag encountered an error while loading.
true if an error occurred, false otherwise.
Checks to see if any media monitored by this media tracker encountered an error while loading.
ID of a group.
true if error happened, false otherwise.
Checks to see if any media in the given group encountered an error while loading.
The image to remove.
Removes the specified image from this MediaTracker.
The image to remove.
ID of a group.
Removes the specified image from this MediaTracker. Only instances matching the given id will be removed.
The image to remove.
ID of a group.
Width of the scaled image, or -1 for unscaled.
Height of the scaled image, or -1 for unscaled.
Removes the specified image from this MediaTracker. Only instances matching the given id and scale sizes will be removed.
Flag to force image loading to start.
MediaTracker status flags ORed together.
Checks load status of all the images monitored by this media tracker; the load parameter may be used to force images to start loading.
ID of a group.
Flag to force image loading to start.
MediaTracker status flags ORed together.
Checks load status of all the images in the given group; the load parameter may be used to force images to start loading.
If waiting interrupted.
Waits for all the images monitored by this media tracker to load.
Time to wait for loading.
If waiting interrupted.
true if images fully loaded, false otherwise.
Waits at most ms milliseconds for all images monitored by this media tracker to load.
ID of a group.
If waiting interrupted.
Waits for images in the given group to load.
ID of a group.
Maximum time to wait for loading.
If waiting interrupted.
true if images fully loaded, false otherwise.
Waits at most ms milliseconds for the images in the given group to load.
Component, Image, Object