
 |
Chapter 19 java.awt Reference |
 |
MediaTracker
Name
MediaTracker
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.
- Parameters
-
- component
-
Component
that eventually renders objects being tracked.
- Description
-
Constructs an MediaTracker
object.
- Parameters
-
- image
-
Image
to track.
- id
-
ID of a group.
- Description
-
Tells a MediaTracker to track the loading of image,
placing the image in the group identified by id.
- Parameters
-
- image
-
Image to track.
- id
-
ID of a group.
- width
-
Eventual rendering
width.
- height
-
Eventual rendering
height.
- Description
-
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.
- Returns
-
true if images completed loading
(successfully or unsuccessfully), false
otherwise.
- Description
-
Determines if all images have finished loading.
- Parameters
-
- load
-
Flag to force image
loading to start.
- Returns
-
true if all images have completed
loading (successfully or unsuccessfully), false
otherwise.
- Description
-
Determines if all images have finished loading; the load
parameter may be used to force images to start loading.
- Parameters
-
- id
-
ID of a group.
- Returns
-
true if all images have completed
loading (successfully or unsuccessfully), false
otherwise.
- Description
-
Determines if all images with the given ID tag have finished loading.
- Parameters
-
- id
-
ID of a group.
- load
-
Flag to force image
loading to start.
- Returns
-
true if all images have completed
loading (successfully or unsuccessfully), false
otherwise.
- Description
-
Determines if all images with the given ID tag have finished loading; the
load parameter may be used
to force images to start loading.
- Returns
-
An array of objects managed by this media tracker that encountered a loading
error.
- Description
-
Checks to see if any media encountered an error while loading.
- Parameters
-
- id
-
ID of a group.
- Returns
-
An array of objects that encountered a loading error.
- Description
-
Checks to see if any media with the given ID tag encountered an error while
loading.
- Returns
-
true if an error occurred,
false otherwise.
- Description
-
Checks to see if any media monitored by this media tracker encountered
an error while loading.
- Parameters
-
- id
-
ID of a group.
- Returns
-
true if error happened, false
otherwise.
- Description
-
Checks to see if any media in the given group encountered an error while
loading.
- Parameters
-
- image
-
The image to remove.
- Description
-
Removes the specified image from this MediaTracker.
- Parameters
-
- image
-
The image to remove.
- id
-
ID of a group.
- Description
-
Removes the specified image from this MediaTracker.
Only instances matching the given id
will be removed.
- Parameters
-
- image
-
The image to remove.
- id
-
ID of a group.
- width
-
Width of the scaled image, or -1 for unscaled.
- height
-
Height of the scaled image, or -1 for unscaled.
- Description
-
Removes the specified image from this MediaTracker.
Only instances matching the given id
and scale sizes will be removed.
- Parameters
-
- load
-
Flag to force image
loading to start.
- Returns
-
MediaTracker status flags ORed
together.
- Description
-
Checks load status of all the images monitored by this media tracker; the
load parameter may be used
to force images to start loading.
- Parameters
-
- id
-
ID of a group.
- load
-
Flag to force image
loading to start.
- Returns
-
MediaTracker status flags ORed
together.
- Description
-
Checks load status of all the images in the given group; the load
parameter may be used to force images to start loading.
- Throws
-
- InterruptedException
-
If waiting
interrupted.
- Description
-
Waits for all the images monitored by this media tracker to load.
- Parameters
-
- ms
-
Time to wait for loading.
- Throws
-
- InterruptedException
-
If waiting
interrupted.
- Returns
-
true if images fully loaded,
false otherwise.
- Description
-
Waits at most ms milliseconds
for all images monitored by this media tracker to load.
- Parameters
-
- id
-
ID of a group.
- Throws
-
- InterruptedException
-
If waiting interrupted.
- Description
-
Waits for images in the given group to load.
- Parameters
-
- id
-
ID of a group.
- ms
-
Maximum time to wait for loading.
- Throws
-
- InterruptedException
-
If waiting
interrupted.
- Returns
-
true if images fully loaded,
false otherwise.
- Description
-
Waits at most ms milliseconds
for the images in the given group to load.
|