List of usage examples for java.awt MediaTracker statusID
public int statusID(int id, boolean load)
From source file:ImageFrame.java
/** * Set the image from a file./*from w w w . j av a 2 s. co m*/ */ public void setImage(File file) throws IOException { // load the image Image image = getToolkit().getImage(file.getAbsolutePath()); // wait for the image to entirely load MediaTracker tracker = new MediaTracker(this); tracker.addImage(image, 0); try { tracker.waitForID(0); } catch (InterruptedException e) { e.printStackTrace(); } if (tracker.statusID(0, true) != MediaTracker.COMPLETE) { throw new IOException("Could not load: " + file + " " + tracker.statusID(0, true)); } setTitle(file.getName()); setImage(image); }