// Wavelet.java import java.applet.Applet; import java.awt.*; public class Wavelet extends java.applet.Applet { public static final String name = "Wavelet"; public static final String version = "1.0"; public static double values[]; static double a[]; public static int n,k; public static double xMarginFactor,yMarginFactor; public static int distance,level; Plot plot; ButtonPanel buttons; TextArea textarea; Scribble scribble; GridBagConstraints constraints; Button bUP,bDOWN; Checkbox haarCB,other1CB,other2CB; public void init() { int i; this.values = new double[2048]; this.a = new double[1000]; Color bgColor = new Color(255,255,255); xMarginFactor = 0.1; yMarginFactor = 0.1; plot = new Plot(this); plot.setBackground(bgColor); constraints = new GridBagConstraints(); buttons = new ButtonPanel(this); // add UP button constraints.weightx = 1.0; constraints.gridx = 0; constraints.gridy = 0; constraints.anchor = GridBagConstraints.CENTER; constraints.fill = GridBagConstraints.HORIZONTAL; bUP = new Button("UP"); buttons.gridbag.setConstraints(bUP,constraints); buttons.add(bUP); // add DOWN button constraints.gridx = GridBagConstraints.RELATIVE; constraints.anchor = GridBagConstraints.CENTER; constraints.fill = GridBagConstraints.HORIZONTAL; bDOWN = new Button("DOWN"); buttons.gridbag.setConstraints(bDOWN,constraints); buttons.add(bDOWN); // add Haar checkbox constraints.gridx = 0; constraints.gridy = 1; constraints.anchor = GridBagConstraints.CENTER; constraints.fill = GridBagConstraints.HORIZONTAL; Checkbox haarCB = new Checkbox("Haar",buttons.cbg,true); buttons.gridbag.setConstraints(haarCB,constraints); buttons.add(haarCB); // add other1 checkbox constraints.gridx = GridBagConstraints.RELATIVE; Checkbox other1CB = new Checkbox("Other1",buttons.cbg,false); buttons.gridbag.setConstraints(other1CB,constraints); buttons.add(other1CB); // add other2 checkbox Checkbox other2CB = new Checkbox("Other2",buttons.cbg,false); buttons.gridbag.setConstraints(other2CB,constraints); buttons.add(other2CB); // buttons.addCheckbox("other1",false); // buttons.addCheckbox("other2",false); textarea = new TextArea(10,40); textarea.setEditable(false); scribble = new Scribble(this); scribble.setBackground(bgColor); setLayout(new GridLayout(4,1,10,10)); add(plot); add(buttons); add(textarea); add(scribble); // initialize to some dummy function n = 16; k = 4; distance = 1; // distance is distance to next value entry level = k; this.values[0] = 0.05; this.values[1] = 0.4; this.values[2] = 0.1; this.values[3] = 0.4; this.values[4] = 0.15; this.values[5] = 0.6; this.values[6] = 0.2; this.values[7] = 0.2; this.values[8] = 0.25; this.values[9] = 0.3; this.values[10] = 0.35; this.values[11] = 0.2; this.values[12] = 0.4; this.values[13] = 0.1; this.values[14] = 0.45; this.values[15] = 0.3; this.values[16] = 0.5; this.values[17] = 0.5; this.values[18] = 0.55; this.values[19] = 0.6; this.values[20] = 0.6; this.values[21] = 0.5; this.values[22] = 0.65; this.values[23] = 0.6; this.values[24] = 0.7; this.values[25] = 0.6; this.values[26] = 0.75; this.values[27] = 0.6; this.values[28] = 0.8; this.values[29] = 0.5; this.values[30] = 0.85; this.values[31] = 0.5; for (i=0; i 1) { this.level++; this.textarea.appendText("go up one level to " + level + "\n"); this.distance /= 2; for (j=0; j