/* Testing graphs - Knut Ekker, knut@neti.no January 1996 */ import java.awt.*; public class graph extends java.applet.Applet implements Runnable { int wx, wy, yoff,xpts[],ypts[],nx,amplitude,origoSin,origoCos, freq; double x0,xmin,xmax,dx,ymin,ymax,dy,xscale,yscale,tmin,t,dt; double width, vwidth, vx; Thread kicker = null; Button Restart = new Button("Restart"); Button Pause = new Button("Pause"); Button Stop = new Button("Stop"); Choice C = new Choice(); Choice C2 = new Choice(); public void init() { wx = size().width; wy = size().height; resize(wx,wy); setBackground(Color.white); yoff = 50; nx = 2*yoff + wx / 2; xpts = new int[nx]; ypts = new int[nx]; origoSin = yoff + 50; origoCos = yoff + 150; amplitude = 30; freq = 3; wy -= yoff; InitSimulation(); Panel p = new Panel(); p.setLayout(new FlowLayout()); p.add(Pause); p.add(Restart); p.add(Stop); C.addItem("Amplitude 1"); C.addItem("Amplitude 2"); C.addItem("Amplitude 3"); C.addItem("Amplitude 4"); C.addItem("Amplitude 5"); C.select ("Amplitude 3"); C2.addItem("Frequency 1"); C2.addItem("Frequency 2"); C2.addItem("Frequency 3"); C2.addItem("Frequency 4"); C2.addItem("Frequency 5"); C2.select ("Frequency 3"); p.add(C); p.add(C2); add("North",p); Restart.disable(); C.disable(); C2.disable(); } public void InitSimulation() { x0 = 1; xmin = 0; xmax = 360; dx = (xmax-xmin)/(nx-1); xscale = (wx-0.5)/(xmax-xmin); for(int x=0;x