Ken's Widget Support Package

This is the support code to make a sliders applet that I use to control my interactive 3d head applet. If you want to use this code for something else, you can look at the files in that head directory, or you can follow the instructions below.

To use: Copy these java files into a folder called widgets: BufferedApplet.java, Button.java, Slider.java, Sliders.java, Widget.java.

Then extend applet class Sliders into a small wrapper class which defines method output that sets things in your target output applet. For example, if you're outputting to an applet called Face, then your output method would look as follows:

   import widgets.*;
   public class FaceSliders extends Sliders
   {
      public void output(int i, double t) {
         ((Face)getOutputApplet()).set(i, t); // call set method in Face class
      }
   }
In your html file, your applet tag must set parameter output to the name of the output applet:
   <applet code=FaceSliders.class name=sliders width=100 height=80>
   <param name=output value=myface>
   </applet>
In our example, we've set the value of output to myface, since the Face applet tag contains the declaration name=myface:
   <applet code=Face.class name=myface width=380 height=500>

To use the slider results, your output applet (the one you're sending the results to, in our case Face) needs to have a public method:

   public void set(int i, double t) {
      ...
   }

You can initialize your sliders by placing something like the following into the head section of your html file:

   <script language=javascript>
      function init() {
         document.sliders.defineSliders("aah ooh sleep brow smile");
         document.sliders.setValues("10 50 20 50 50");
      }
   </script>

and forcing a load-time call to init() in your html body declaration:

   <body onLoad="init()">