public static boolean waitForImage(String imageName, Image image) {

		if (image instanceof BufferedImage) {
			return true;
		}

		if (image.getWidth(null) > 0 && image.getHeight(null) > 0) {
			return true;
		}

		MediaTracker tracker = new MediaTracker(getMediaTrackerComponent());
		int maxWaits = 20; // 2 seconds...not sure if we can ever hit this limit
		int waitTime = 100;
		tracker.addImage(image, 0);
		for (int i = 0; i < maxWaits; i++) {
			try {
				tracker.waitForID(0, waitTime);
				int width = image.getWidth(null);
				int height = image.getHeight(null);
				if (width < 0 || height < 0) {
					continue; // try again
				}
				tracker.removeImage(image, 0);
				return true;
			}
			catch (InterruptedException e) {
				// don't care; try again
			}

		}

		Msg.debug(ImageUtils.class, "Timed-out waiting for image to load after " +
			((maxWaits * waitTime) / 1000) + " seconds; " + imageName);
		tracker.removeImage(image, 0);
		return false;
	}
Waits a reasonable amount of time for the given image to load
 
@param imageName the name of the image
@param image the image for which to wait
@return true if the wait was successful
Ghidra/Framework/Gui/src/main/java/generic/util/image/ImageUtils.java