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

public class Mensch extends Applet implements Runnable {
    int startx, starty;
    int i;
    Thread mensch = null;


   public void init() {
      startx = 10;
      starty = 10;
   }
   
   public void start(){
      if ( mensch == null ) {
         mensch = new Thread ( this );
         mensch.start();
      }   
   }
   
   public void stop() {
      if ( mensch != null ) {
         mensch.stop();
         mensch = null;
      }
   }

   public void run() {
      while ( true ) {
         for ( i = 0; i < 10; i++ ) {
            repaint();
            try { mensch.sleep(100); }
            catch ( InterruptedException e ) {}
         }
         for ( ; i > 0; i-- ) {
            repaint();
            try { mensch.sleep(100); }
            catch ( InterruptedException e ) {}
         }
      }
   }
   
   public void paint ( Graphics g )
   {
      int x = startx + 2*i;
      int y = starty + i;

      // Koordinatensystem fr den Menschen
      g.drawLine ( x, y, x+70, y );
      g.drawLine ( x, y, x, y+100 );

      g.drawOval ( x+22, y+4, 16, 18 );      // Kopf
      g.drawLine ( x+29, y+13, x+27, y+17 );
      g.drawLine ( x+27, y+17, x+29, y+17 );
      g.drawOval ( x+27, y+10, 1, 2 );
      g.drawOval ( x+33, y+10, 1, 2 );
      g.drawLine ( x+30, y+22, x+30, y+50 ); // Rumpf
      g.drawLine ( x+30, y+50, x+20, y+90 ); // linkes Bein
      g.drawLine ( x+30, y+50, x+40, y+90 ); // rechtes Bein 
      g.drawLine ( x+40, y+90, x+45, y+90 ); // linker Fu
      g.drawLine ( x+20, y+90, x+15, y+90 ); // rechter Fu   
      g.drawLine ( x+30, y+30, x, y+27 );    // linker Arm
      g.drawLine ( x+30, y+30, x+33, y+30 ); // rechte Schulter
      // linker Arm wird bewegt
      g.drawLine ( x+33, y+30, x+60-i, y+27-3*i+10);
   }

}
