Here you can find the source of waitForImage(Image image, Component c)
true
if the given image is loaded successfully.
Parameter | Description |
---|---|
image | an AWT image |
c | an AWT component |
public static boolean waitForImage(Image image, Component c)
//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()); } }