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

public
class FlowString extends Applet implements Runnable
{
   int x, y, j;
   String napis;
   Font fontTimesRoman;
   public void init()
   {
      x = 0;
      y = 180;
      j = 1;
      napis = new String ("HOP HOP");
      fontTimesRoman = new Font ("TimesRoman", Font.BOLD, 36);
   }
   public void start()
   {
      Thread thread = new Thread (this);
      thread.start();
   }
   public void run()
   {
      while (true){
         x += j;
         if ((j == 1) && (x > 530)){
            j = -1;
         }
         else if (x <= 0){
            j = 1;
         }
         try{
            Thread.sleep(10);
         }
         catch (InterruptedException e){
         }
         repaint();
      }
   }
   public void paint(Graphics gDC)
   {
      gDC.setColor (Color.blue);
      gDC.setFont (fontTimesRoman);
      gDC.drawString (napis, x, y);
   }
}
