Banner Applet in Java using applet

import java.awt.*;
import java.applet.*;

/* <applet code="simplebanner" width=300 height=100>
   </applet>
*/

public class simplebannner extends Applet implements Runnable
{
    String msg = " A banner produced by me ";
    Thread t= null;
    int state;
    boolean stopFlag;
    public void init()
    {
        setBackground(Color.cyan);
        setBackground(Color.orange);
    }
    public void start()
    {
        t=new Thread(this);
        stopFlag=false;
        t.start();
    }
    
    public void run()
    {
        char ch;
        for(;;)
        {
            try
            {
                repaint();
                Thread.sleep(250);
                ch=msg.charAt(0);
                msg=msg.substring(1,msg.length());
                msg=msg + ch;
                if(stopFlag)
                    break;
            }catch(InterruptedException e){}
        }
    }
    public void stop()
    {
        stopFlag=true;
        t=null;
    }
    public void paint(Graphics g)
    {
        g.drawString(msg,75,79);
    }
}

Top