Here you can find the source of waitForImage(Image image)
public static boolean waitForImage(Image image)
//package com.java2s; /*//from ww w . ja v a 2 s . c o m * @(#)ImageUtil.java 1.2 04/12/06 * * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * * See the file "LICENSE.txt" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ import java.awt.*; public class Main { static Component component = new Component() { }; static MediaTracker tracker = new MediaTracker(component); static int sid = 0; public static boolean waitForImage(Image image) { int id; synchronized (component) { id = sid++; } tracker.addImage(image, id); try { tracker.waitForID(id); } catch (InterruptedException e) { return false; } tracker.removeImage(image, id); return !tracker.isErrorID(id); } }