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

public class marquee extends Applet implements Runnable
  {

    int x = 0;
    int y = 0;
    String msg = null;
    int width = 0;
    Thread my_thread = null;


    public void init()
      {
	msg = getParameter("msg");
	if(msg==null) msg="Hello, nobody left a message";
        x = size().width;
        y = size().height / 2;
        width = x;
	setBackground(Color.white);
      }


    public void start()
      {

        my_thread = new Thread(this);
        my_thread.start();

      }


    public void run()
      {

        while(true)
          {

            repaint();
            x -= 10;
            if(x < 0)
              x = width;

            try
              {

                Thread.sleep(100);

                  // The previous statement produces a compiler
                  // warning without a try/catch statement.

              }
            catch(InterruptedException e)
              {
              }

          }

      }


    public void paint(Graphics g)
      {
        g.drawString(msg, x, y);
      }

  }
