import java.awt.*;

public class Defil extends java.applet.Applet      implements Runnable
{
  Thread   MyThread;
  int      Indic = 1, taille, Dx=60;
  Graphics Mongraph;
  Image    Monimage;
       
  public void init()
  {
    //Monimage = createImage( getSize().width, getSize().height);
	Monimage = createImage( 700, 200 );
    Mongraph = Monimage.getGraphics();
  }

  public void start()
  {
    if ( MyThread == null ) {
      MyThread = new Thread(this);
      MyThread.start(); 
    }
  }

  public void stop()
  {
    if ( MyThread != null ) {
       Indic =0;
       MyThread=null;
    }
  }

  public void run()
  {
    while ( Indic == 1 ) {
      for ( taille=20; taille<=80; taille++ ) {
        Dx-=2;
        attente(); 
      }

      for(taille=80; taille>=20; taille--) {
        attente(); 
        Dx+=2;
      }
    }
  }

  public void attente()
  {
    repaint();

    try {
      Thread.sleep(10);
    } catch(InterruptedException ie) {
    }
  }

  public void update(Graphics g)
  {
    paint(g);
  }

  public void paint(Graphics g)
  {
    Mongraph.setColor(Color.white);
    Mongraph.fillRect(0,0,700,200);
    Mongraph.setColor(Color.black); 
    Mongraph.setFont(new Font("Arial",Font.BOLD,taille));
    Mongraph.drawString("Demo Text Animé", Dx+55,100);
    g.drawImage(Monimage,0,0,this);
  }
}
