import java.awt.*; import java.applet.*; public class TrackedImage extends Applet implements Runnable { private Image picture; private MediaTracker tracker; public void init() { this.picture = this.getImage(this.getCodeBase(), this.getParameter("imagefile")); this.tracker = new MediaTracker(this); this.tracker.addImage(this.picture, 1); Thread play = new Thread(this); play.start(); } public void run() { try { this.tracker.waitForID(1); this.repaint(); } catch (InterruptedException ie) { } } public void paint(Graphics g) { if (this.tracker.checkID(1, true)) { g.drawImage(this.picture, 0, 0, this); } else { g.drawString("Loading Picture. Please hang on", 25, 50); } } }