import browser.Applet; import awt.Graphics; /** Program: Scene class Purpose: applet that implements a scene of activity @author john@december.com @version 1.99; 23 Jul 1995 */ class Scene extends Applet implements Runnable { static int sceneWidth = 500; static int sceneHeight = 500; private Thread flow; private Events action; private boolean done = false; private boolean pause = false; public void init() { resize(sceneWidth, sceneHeight); } public void start() { flow = new Thread(this); flow.start(); action = new Events(); } public void paint(Graphics context) { context.clearRect(0, 0, sceneWidth, sceneHeight); action.nextEvent(); action.paint(context); done = (action.moreEvents() == false); } public void update() { repaint(); } public void run() { try { while (!done) { if (!pause) repaint(); } } } public void stop() { done = true; if (flow.isAlive()) flow.stop(); flow = null; } public void mouseDown(int x, int y) { pause = !pause; } }