FileDocCategorySizeDatePackage
RelativeGong.javaAPI DocExample649Thu Apr 03 15:19:58 BST 1997None

RelativeGong.java

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

public class RelativeGong extends Applet implements Runnable {

  AudioClip theGong;
  Thread t;

  public void init() {

    theGong = getAudioClip(getDocumentBase(), "sounds/gong.au");
    if (theGong != null) {
      t = new Thread(this);
      t.start();
    }
  
  }

  public void start() {
    t.resume();
  }
  
  public void stop() {
    t.suspend();
  }
  
  public void run() {
    
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    while (true) {
      theGong.play();
      try {
        Thread.sleep(5000);
      }
      catch (InterruptedException e) {
      }
    }
  
  }

}