MediaTracker

Name

MediaTracker

[Graphic: Figure from the text]

Description

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.

Class Definition

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;
}

Constants

ABORTED

public static final int ABORTED

Flag that indicates that the loading process aborted while loading a particular image.

COMPLETE

public static final int COMPLETE

Flag that indicates a particular image loaded successfully.

ERRORED

public static final int ERRORED

Flag that indicates an error occurred while a particular image was loading.

LOADING

public static final int LOADING

Flag that indicates a particular image is still loading.

Constructors

MediaTracker

public MediaTracker (Component component)

Instance Methods

addImage

public void addImage (Image image, int id)

public synchronized void addImage (Image image, int id, int width, int height)

checkAll

public boolean checkAll()

public synchronized boolean checkAll (boolean load)

checkID

public boolean checkID (int id)

public synchronized boolean checkID (int id, boolean load)

getErrorsAny

public synchronized Object[] getErrorsAny()

getErrorsID

public synchronized Object[] getErrorsID (int id)

isErrorAny

public synchronized boolean isErrorAny()

isErrorID

public synchronized boolean isErrorID (int id)

removeImage

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)

statusAll

public synchronized int statusAll (boolean load)

statusID

public synchronized int statusID (int id, boolean load)

waitForAll

public void waitForAll() throws InterruptedException

public synchronized boolean waitForAll (long ms) throws InterruptedException

waitForID

public void waitForID (int id) throws InterruptedException

public synchronized boolean waitForID (int id, long ms) throws InterruptedException

See Also

Component, Image, Object