<SCRIPT> function infoFromJava_Slider(sliderNaam,waarde) { document.A8.veld1.value=waarde; } function setModel(form) { t = 0.0; dt = 1.0; Tmin = 0.0; Tmax = 1000.0; x = 100; //start values and parameter values y = 5000; p = 1.0; document.slider1.setPMax(1.5); //input object. document.slider1.setPMin(0.0); document.slider1.setPStart(1.0); document.slider1.setDigits(4); p = document.A8.veld1.value; document.grafiekAB.setYmaxb("200"); //output object. document.grafiekAB.setYminb("0"); document.grafiekAB.setYmaxo("6000"); document.grafiekAB.setYmino("4000"); aantalpunten=Math.round(Tmax/dt); //aantal punten 1000/10=100!! document.grafiekAB.setPunten(aantalpunten); } function runModel(form) { var string1=""; iii = document.A8.veld1.value; p = parseFloat(iii); for (var i=0; i<aantalpunten; i++) { t = t + dt; dxdt = 0.1*p; dydt = -0.2; x = x + dxdt*dt; y = y + dydt*dt; ix = Math.round (x); iy = Math.round (y); document.grafiekAB.setUpper(string1 + ix ); document.grafiekAB.setLower(string1 + iy ); } } </SCRIPT> <FORM NAME="A8"> <P> <applet code=slider.class name=slider1 width=200 height=16 MAYSCRIPT> </applet> <INPUT TYPE="text" NAME="veld1" VALUE="aaa" SIZE="10"> <P> <APPLET CODE=grafiek.class NAME=grafiekAB WIDTH=300 HEIGHT=300> </APPLET> <INPUT TYPE="button" VALUE="Reset" ONCLICK="setModel(this.form)"> <INPUT TYPE="button" VALUE="Run" ONCLICK="runModel(this.form)"> </FORM>
You have to reset everytime...
Objects: an applet with the name 'slider1', an applet ... 'grafiekAB', a button ... "Reset' and a method 'setModel', a button 'Run' and a method 'runModel', a form 'veld1' and a form with the name 'A8'. In the form 'A8' there are two applets, two buttons and one output-field.
t = t + dt x = f1(p,t) y = f2(p,t)
The function 'run' runs the model and the output until 'Tmax'.
Be careful: 1000 internal points in the internal buffer. More points gives java-error. See the other examples.
De maximum of y and the minimal of y you have to set with 'setYmaxb' and 'setYmaxb'.
You need the function infoFromJava_Slider (sliderNaam, waarde) for sending an event.
Enschede, 10 febr. 2000; updated jan 2003.