import java.applet.Applet; import java.awt.*; public class ticker2 extends Applet implements Runnable { String myText; Thread myThread; int mySleepPeriod = 1000; public void init() { myText=getParameter("text"); myThread = null; } public void start() { if (myThread == null) { myThread = new Thread(this,"MyThread"); myThread.start(); } } public void run() { while (myThread != null) { repaint(); try { myThread.sleep(mySleepPeriod); } catch (InterruptedException e) {} } } public void paint(Graphics g) { Color c = new Color((int) (Math.random()*255), (int) (Math.random()*255), (int) (Math.random()*255)); g.setColor(c); g.drawString(myText,50,25); } public void stop() { myThread.stop(); myThread = null; } }