import java.awt.*;
import java.applet.*;

public class EiA992 extends Applet implements Runnable
{
 Thread ruch=null;

//   Zmienna ruch jest obiektem typu Thread tj.obiekt niezbędny 
//   w modułach wykonywalnych
//   obiekt typy Thread uruchamia funkcja start()

 public int xokna,yokna; 

// xokna,yokna są wymiarami okna apeletu ustalanymi w wywołaniu HTMLa

 public int xs,ys,dx;

// xs,yx,ds zmienne pomocnicze 
 
 public void init()
   {
    xokna=size().width;
    yokna=size().height;
    xs=xokna;
    ys=25;
   }
 public void start()
   {
    if (ruch == null)
     {
      ruch=new Thread(this);
      ruch.start();
     }
   }

 public void run()

// Fukcja run() jest wywoływana przez funkcję start() i określa właściwe 
// działanie apletu typu Runnable

  {
   while (true)
    {
      if (xs>xokna-10) dx=-5;
      if (xs<-xokna) xs=xokna;
      xs=xs+dx;         
      repaint();   
      try
        {
          ruch.sleep(150);
        }
      catch (InterruptedException e)
        {
        }
    }
  }

 
public void paint(Graphics g)
    {
     Font fn=new Font("Courier",Font.BOLD,20); // Arial, TimesRoman
     g.setFont(fn);
     g.setColor(Color.blue);
     g.drawString(" PODYPLOMOWE STUDIUM INFORMATYKI DLA NAUCZYCIELI ",xs,ys);  
     g.setColor(Color.red);     
     g.drawString("      Wydział MIM - Uniwersytet Warszawski ",xs ,ys + 25);  
    }

}
