Example usage for java.awt MediaTracker removeImage

List of usage examples for java.awt MediaTracker removeImage

Introduction

In this page you can find the example usage for java.awt MediaTracker removeImage.

Prototype

public synchronized void removeImage(Image image, int id) 

Source Link

Document

Removes the specified image from the specified tracking ID of this media tracker.

Usage

From source file:net.sf.firemox.tools.MToolKit.java

/**
 * Return the loaded picture from a local place.
 * /*from   ww w  .j a v  a 2 s  .c o  m*/
 * @param localFile
 *          the local file name.
 * @return the local picture.
 * @throws InterruptedException
 */
public static Image getLocalPicture(String localFile) throws InterruptedException {
    final Image result = Toolkit.getDefaultToolkit().getImage(getFile(localFile, true).getAbsolutePath());
    if (result == null) {
        throw new InterruptedException("Picture " + localFile + " has not been found");
    }
    final MediaTracker tracker = new MediaTracker(MagicUIComponents.magicForm);
    tracker.addImage(result, 0);
    tracker.waitForAll();
    if (tracker.isErrorAny()) {
        tracker.removeImage(result, 0);
        tracker.waitForAll();
        result.flush();
        throw new InterruptedException("Malformed picture " + localFile);
    }
    return result;
}