FileDocCategorySizeDatePackage
NewAnimate.javaAPI DocExample2190Thu Feb 04 16:10:36 GMT 1999None

NewAnimate

public class NewAnimate extends Applet

Fields Summary
int
count
int
lastcount
Image[]
pictures
TimerThread
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 voidstart()

		timer = new TimerThread(this, 1000);
		timer.start();
	
public voidstop()

		timer.shouldRun = false;
		while (timer.isAlive()) {
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {}
		}
		timer = null;