import java.awt.*; import java.applet.*; import java.net.URL; //*********************************************************************************** /** Starts Control */ //*********************************************************************************** public class startControl extends Applet { /** true if window showing */ public boolean showing=false; private Control win; private Label l1; private Button b1; private String loading = "Please wait...loading!"; private String startApp= "Click here to start application: "; private String stopApp= "Click here to stop application: "; public boolean inputParameters=false; public String[] parameterBoxes; public String[] variableBoxes; public int nParameters; public int nVariables; public int function; public int controlVariable; public double change; public int period; public int speed; /** location of marker.txt */ URL documentBase; public void init() { if(getFromApplet("setParameters","False").equals("True")) inputParameters=true; if(inputParameters) getAllParameters(); setLayout(new FlowLayout(FlowLayout.CENTER)); l1 = new Label(startApp); add(l1); b1 = new Button("Start"); add(b1); documentBase = getCodeBase(); } public void showWindow() { b1.disable(); l1.setText(loading); win = new Control (this, documentBase); win.setTitle(" Controlling Chaos "); // win.setBackground(Color.white); win.resize(640,480); win.show(); showing=true; b1.setLabel("Stop"); b1.enable(); l1.setText(stopApp); } public void hideWindow() { win.movieStop(); win.dispose(); b1.setLabel("Start"); l1.setText(startApp); showing=false; } /**********************************************************************/ public boolean action(Event evt, Object arg) { if(evt.target instanceof Button) { // System.out.println("Button down"); // System.out.println("Showing = " + showing); if(showing) { hideWindow(); } else { showWindow(); } return true; } else return false; } protected String getFromApplet(String parameter, String s) { String getString = getParameter(parameter); if(getString == null) return s; else if(getString.length() == 0) return s; else return getString; } protected void getAllParameters() { int i,j; nParameters=(new Integer(getFromApplet("nParameters","0"))).intValue(); nVariables=(new Integer(getFromApplet("nVariables","0"))).intValue(); function=(new Integer(getFromApplet("function","0"))).intValue(); parameterBoxes = new String[nParameters]; variableBoxes = new String[nVariables]; for(i=0;i