Methods Summary |
---|
public void | init()
String basename = this.getParameter("basename");
int num_images;
try { num_images = Integer.parseInt(this.getParameter("num_images")); }
catch (NumberFormatException e) { num_images = 0; }
images = new Image[num_images];
for(int i = 0; i < num_images; i++) {
images[i] = this.getImage(this.getDocumentBase(), basename + i);
}
|
public void | run()
while(true) {
if (++current_image >= images.length) current_image = 0;
this.getGraphics().drawImage(images[current_image], 0, 0, this);
this.getToolkit().sync(); // Force it to be drawn *now*.
try { Thread.sleep(200); } catch (InterruptedException e) { ; }
}
|
public void | start()
if (animator_thread == null) {
animator_thread = new Thread(this);
animator_thread.start();
}
|
public void | stop()
if ((animator_thread != null) && animator_thread.isAlive())
animator_thread.stop();
// We do this so the garbage collector can reclaim the Thread object.
// Otherwise it might sit around in the Web browser for a long time.
animator_thread = null;
|