FileDocCategorySizeDatePackage
Animate.javaAPI DocExample2396Thu Feb 04 16:10:34 GMT 1999None

Animate

public class Animate extends Applet implements Runnable

Fields Summary
int
count
int
lastcount
Image[]
pictures
Thread
timer
Constructors Summary
Methods Summary
public voidinit()

        lastcount = 10; count = 0;
        pictures = new Image[10];
        MediaTracker tracker = new MediaTracker(this);
        for (int a = 0; a < lastcount; a++) {
            pictures[a] = getImage (
                getCodeBase(), new Integer(a).toString()+".jpeg");
            tracker.addImage(pictures[a], 0);
        }
        tracker.checkAll(true);
    
public voidpaint(java.awt.Graphics g)

        g.drawImage(pictures[count++], 0, 0, null);
        if (count == lastcount) count = 0; 
    
public voidrun()

        while (isActive()) {
            try {
                repaint();
                Thread.sleep(1000);
            } catch (Exception e) {}
        }
        timer = null;
    
public voidstart()

        if (timer == null) {
            timer = new Thread(this);
            timer.start();
        }