import java.applet.*; import java.awt.*; public class RelativeBeep extends Applet implements Runnable { private AudioClip beep; private boolean stopped = false; public void init() { this.beep = this.getAudioClip(this.getDocumentBase(), "sounds/beep.au"); if (this.beep != null) { Thread t = new Thread(this); t.start(); } } public void start() { this.stopped = false; } public void stop() { this.stopped = true; } public void run() { Thread.currentThread().setPriority(Thread.MIN_PRIORITY); while (true) { if (!stopped) this.beep.play(); try { Thread.sleep(5000); } catch (InterruptedException e) { } } } }