/*
*
*Banner Applet (VoodooBanner.class)
*This applet is not my original work
*It was available to me from The Complete Reference - Java 2 3rd Ed
*by Patrick Naughton & Herbert Schildt
*
*Comments & Suggestions will be appreciated
*Mail: gnashes30@yahoo.com
*
*You may feel free to use this applet as is if you include a credit to me
*on your site along with my mail id
*
*You may also feel free to distribute it as long as the commented lines
*originally present are included in the class files
*
*If you wish to employ me mail me - gnashes30@yahoo.com
*
*Home page -
* www.VoodooStar.f2s.com
* www.geocities.com/gnashes30
*
*/

import java.awt.*;
import java.applet.*;

/*
<applet code="VoodooBanner" width=300 height=50>
</applet>
*/
public class VoodooBanner extends Applet implements Runnable{

	String msg = "This is a moving banner Applet ! ";
	Thread th = null;
	int state;
	boolean flag;

	public void init(){
		setBackground(Color.black);
		setForeground(Color.cyan);
		setFont(new Font("Arial" , Font.BOLD , 15));
	}

	public void start(){
		th = new Thread(this);
		flag = false;
		th.start();
	}

	public void run(){
		char c;

		for (; ; )
		{
			try
			{
				repaint();
				Thread.sleep(200);
				c = msg.charAt(0);
				msg = msg.substring(1,msg.length());
				msg += c;
				if (flag)
				{
					break;
				}
			}
			catch (InterruptedException e){}
		}
	}

	public void stop(){
		flag = true;
		th = null;
	}

	public void paint(Graphics g){
		g.drawString(msg , 50 , 30);
	}
};