public class Fall_String implements Runnable {
  Thread kick;
  int x = 0, y = 0;
  int speed = 200;
  int width = 0, height = 0;

  Fall_String (int width, int height) {
    this.width = width;
    this.height = height;
    x = (int)(Math.random() *  width);
    speed = 50 + (int)(Math.random() *  50);
  }

  public void start() {
    if (kick == null) {
      kick = new Thread(this);
      kick.start();
    }
  }

  public void run() {
    while (true) {
      y += 5;
      if (y >= height) {
	y = 0;
	x = (int)(Math.random() *  width);
	speed = 50 + (int)(Math.random() *  50);
      }
      try {
	Thread.sleep(speed);
      } catch (InterruptedException e) {
      }
    }
  }

  public int getX() {
    return x;
  }

  public int getY() {
    return y;
  }

  public void stop() {
    if (kick != null) {
      kick.stop();
      kick = null;
    }
  }
}

