import java.applet.Applet; import java.awt.*; public class tickertape8 extends Applet implements Runnable { String msg; String pause_str; int x, y; int horizStep=2; int msgWidth; int pause=25; Thread ourThread; Color c=new Color(239,247,247); Color d=new Color(255,0,0); Image img; Graphics off; public void init() { img=createImage(size().width,size().height); off=img.getGraphics(); x=size().width; msg=getParameter("I Am Not Ashamed Of The Gospel Of Jesus Christ!"); pause_str=getParameter("pause"); if (msg==null) { msg="I Am Not Ashamed Of The Gospel Of Jesus Christ!"; } if (pause_str != null) { pause=Integer.parseInt(pause_str); } else { pause=25; } } public void start() { ourThread = new Thread(this); ourThread.start(); } public void run() { while (ourThread != null) { repaint(); try { ourThread.sleep(pause); } catch (InterruptedException e) { return; } } } public void paint(Graphics g) { g.setColor(c); g.fillRect(0,0,size().width,size().height); g.setColor(d); Font f=new Font("TimesRoman",Font.BOLD,36); g.setFont(f); FontMetrics fm=getFontMetrics(f); msgWidth=fm.stringWidth(msg); y=size().height-(fm.getHeight()/3); if (x>-msgWidth) x=x-horizStep; else x=size().width; g.drawString(msg, x, y); } public void update(Graphics g) { paint(off); g.drawImage(img,0,0,null); } public void stop() { ourThread = null; } }