FileDocCategorySizeDatePackage
TrackedImage.javaAPI DocExample862Sat Sep 09 20:33:28 BST 2000None

TrackedImage

public class TrackedImage extends Applet implements Runnable

Fields Summary
private Image
picture
private MediaTracker
tracker
Constructors Summary
Methods Summary
public voidinit()


    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 voidpaint(java.awt.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);
    }
    
  
public voidrun()

  
    try {
      this.tracker.waitForID(1);
      this.repaint();
    }
    catch (InterruptedException ie) {      
    }