Java Image Wait waitForImage(Image image, Component c)

Here you can find the source of waitForImage(Image image, Component c)

Description

Returns true if the given image is loaded successfully.

License

Open Source License

Parameter

Parameter Description
image an AWT image
c an AWT component

Declaration

public static boolean waitForImage(Image image, Component c) 

Method Source Code

//package com.java2s;
// are made available under the terms of the Eclipse Public License v1.0

import java.awt.Component;

import java.awt.Image;
import java.awt.MediaTracker;

public class Main {
    /**//from w  w w  . ja va  2 s. c om
     * Returns <code>true</code> if the given image is loaded successfully.
     * 
     * @param image
     *            an AWT image
     * @param c
     *            an AWT component
     */
    public static boolean waitForImage(Image image, Component c) {
        MediaTracker tracker = new MediaTracker(c);
        tracker.addImage(image, 0);
        try {
            tracker.waitForAll();
        } catch (InterruptedException ie) {
        }
        return (!tracker.isErrorAny());
    }
}

Related

  1. waitFor(Image image)
  2. waitForImage(Image image)
  3. waitForImage(Image image)
  4. waitForImage(Image image)
  5. waitForImage(Image image, Component component)
  6. waitForImage(Image image, Component component)
  7. waitForImage(java.awt.Image image)
  8. waitForImage(java.awt.Image image)