// PolysMove.java // A Test Animation for Polys // Copyright (C) 1996, 1997 Y.Nagatani // nagatani@eken.phys.nagoya-u.ac.jp import java.awt.Graphics; import java.awt.Color; import Polys; public class PolysMove extends Polys implements Runnable { Thread thread; public int interval; // interval (mili sec) public void init() { super.init(); try {interval = getIntParameter ("interval");} catch (NumberFormatException e) { interval = 500; } if (interval < 0) interval = 0; } public void paint (Graphics g) { super.paint (g); } public void update (Graphics g) { super.paint (g); } public void run () { while (thread.isAlive ()) { repaint(); try { Thread.sleep (interval); // Delay Time } catch (InterruptedException e) {} } } public void start () { if (thread == null) { thread = new Thread (this); thread.start (); // start thread } } public void stop() { if (thread != null) { thread.stop (); // stop thread thread = null; // delete thread } } public String[][] getParameterInfo () { String info[][] = { {"interval", "integer", "flush interval (milisecond)"} }; return info; } public String getAppletInfo () { return "PolysMove (test for Polys)\n" + "Copyright(C) 1996, 1997 Y.nagatani\n" + "nagatani@eken.phys.nagoya-u.ac.jp"; } }