java.awt.MediaTracker (JDK 1.0)
This class provides a very convenient way to asynchronously load and keep track of the status of any number of Image objects. You can use it to load one or more images and to wait until those images have been completely loaded and are ready to be used.
The addImage() method registers an image to be loaded and tracked and assigns it a specified identifier value. waitForID() loads all images that have been assigned the specified identifier and returns when they have all finished loading or it has received an error. isErrorAny() and isErrorID() check whether any errors have occurred while loading images. statusAll() and statusID() return the status of all images or of all images with the specified identifier. The return value of these two methods is one of the defined constants.
public classMediaTrackerextends Object implements Serializable { //Public ConstructorpublicMediaTracker(Componentcomp); //Constantspublic static final intABORTED; public static final intCOMPLETE; public static final intERRORED; public static final intLOADING; //Public Instance Methodspublic voidaddImage(Imageimage, intid); public synchronized voidaddImage(Imageimage, intid, intw, inth); public booleancheckAll(); public booleancheckAll(booleanload); public booleancheckID(intid); public booleancheckID(intid, booleanload); public synchronized Object[]getErrorsAny(); public synchronized Object[]getErrorsID(intid); public synchronized booleanisErrorAny(); public synchronized booleanisErrorID(intid); 1.1 public synchronized voidremoveImage(Imageimage); 1.1 public synchronized voidremoveImage(Imageimage, intid); 1.1 public synchronized voidremoveImage(Imageimage, intid, intwidth, intheight); public intstatusAll(booleanload); public intstatusID(intid, booleanload); public voidwaitForAll() throws InterruptedException; public synchronized booleanwaitForAll(longms) throws InterruptedException; public voidwaitForID(intid) throws InterruptedException; public synchronized booleanwaitForID(intid, longms) throws InterruptedException; }