Here you can find the source of waitForImage(Image image, Component component)
public static boolean waitForImage(Image image, Component component)
//package com.java2s; /*/*from w w w . j a va 2s. com*/ * Copyright (C) 2004 by StreetFire Sound Labs * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: Util.java,v 1.7 2005/03/22 08:59:06 iain Exp $ */ import java.awt.Component; import java.awt.Image; import java.awt.MediaTracker; public class Main { /** * Wait for an image to be ready * @return boolean false if interrupted */ public static boolean waitForImage(Image image, Component component) { MediaTracker mediaTracker = new MediaTracker(component); mediaTracker.addImage(image, 0); try { mediaTracker.waitForID(0); } catch (InterruptedException e) { return false; } return true; } }