FileDocCategorySizeDatePackage
trackImage.javaAPI DocExample798Thu Apr 03 15:22:32 BST 1997None

trackImage

public class trackImage extends Applet implements Runnable

Fields Summary
Thread
play
Image
thePicture
MediaTracker
theTracker
Constructors Summary
Methods Summary
public voidinit()


    thePicture = getImage(getDocumentBase(), getParameter("imagefile"));
    theTracker = new MediaTracker(this);
    theTracker.addImage(thePicture, 1);
       
    play = new Thread(this);
    play.start();
  
  
public voidpaint(java.awt.Graphics g)

   
    if (theTracker.checkID(1, true)) {
      g.drawImage(thePicture, 0, 0, this);
      play.stop();
    }
    else {
      g.drawString("Loading Picture. Please hang on", 25, 50);
    }
    
  
public voidrun()

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