import java.awt.*; /** Program: NoisyWave24 Purpose: @author: Paul Garrett, garrett@math.umn.edu @version: 24, Fri Jan 17 15:40:28 CST 1997 */ public class NoisyWave24 extends java.applet.Applet implements Runnable { Thread theThread; int[][] thePoints; // time, enumerate points, y int theTime; // int numberSubintervals; // int totalTime; // total number of frames float theSpeed; // default = 1 int xIncrement; // increment in x int waveConstant; boolean queryInit; // to tell whether computations done and ready... Color bgColor; // background Color fgColor; // foreground Image offScreenImage; // for double-buffering Graphics offScreenGraphics; // ditto /* Above are all the instance variables.... */ public void init() { waveConstant = 2; offScreenImage = createImage(this.size().width, this.size().height); // size of applet offScreenGraphics = offScreenImage.getGraphics(); //Button go = new Button("go"); //add(go); //Button stop = new Button("stop"); //add(stop); bgColor = Color.darkGray; fgColor = Color.white; // for example...... reverse video... setBackground(bgColor); setForeground(fgColor); // offScreenGraphics.setBackground(bgColor); // does this work? NO?! numberSubintervals = 100; xIncrement = 4; // screen width vs. numberS * xInc and 420... theTime = 0; totalTime = 400; computeFrames(); } void computeFrames() { thePoints = new int[totalTime][numberSubintervals + 1]; // NB the "+1" thePoints[0][0] = thePoints[1][0] = 0; thePoints[0][numberSubintervals] = thePoints[1][numberSubintervals] = 0; // endpoints fixed for (int x=0; x <= numberSubintervals / 5 ; x++) { // "5" ? thePoints[0][x] = thePoints[1][x] = (int) (100 * Math.sin( ((float) x) * Math.PI / 20) * Math.sin( ((float) x) * Math.PI / 20)); } // NB other points initialized to 0 by declaration above for (int t=2; t