home *** CD-ROM | disk | FTP | other *** search
/ Netscape Plug-Ins Developer's Kit / Netscape_Plug-Ins_Developers_Kit.iso / plugins / WIRL / wirlb1g.exe / data.1 / VRCJuice.java < prev    next >
Encoding:
Java Source  |  1996-03-04  |  2.0 KB  |  75 lines

  1. import java.awt.*;
  2. import java.applet.*;
  3. import VRCAPI;
  4. import VRCRobot;
  5.  
  6. //class InitButton extends button{
  7. public class VRCJuice extends Applet
  8. {
  9.     VRCRobot VRCRobo;
  10.     boolean INIT = false;
  11.  
  12.     public void init()
  13.     {
  14.         setLayout(new GridLayout(1,3));
  15.         add("a",new Button("Right Arm"));
  16.         add("b",new Button("Right Leg"));
  17.         add("c",new Button("Torso"));
  18.         add("d",new Button("Left Leg"));
  19.         add("e",new Button("Left Arm"));
  20.         add("i",new Button("Color"));
  21.         add("f",new Button("Animate"));
  22.         add("h",new Button("Walk"));
  23.         add("g",new Button("Restart"));
  24.     }
  25.  
  26.     public void destroy()
  27.     {
  28.         VRCRobo.destroy();
  29.         System.gc();
  30.         INIT = false;
  31.     }
  32.  
  33.     public boolean action(Event evt, Object arg)
  34.     {
  35.         if (evt.target instanceof Button){
  36.             if (!INIT){
  37.                 VRCRobo = new VRCRobot();
  38.                 INIT = true;
  39.             }
  40.             String label = (String)arg;
  41.             if (label.equals("Right Arm")){
  42.                 VRCRobo.asyncRWave();
  43.             }
  44.             else if(label.equals("Left Arm")){
  45.                 VRCRobo.asyncLWave();
  46.             }
  47.             else if(label.equals("Left Leg")){
  48.                 VRCRobo.asyncLLeg();
  49.             }
  50.             else if(label.equals("Right Leg")){
  51.                 VRCRobo.asyncRLeg();
  52.             }
  53.             else if(label.equals("Restart")){
  54.                 destroy();
  55.             }
  56.             else if(label.equals("Torso")){
  57.                 VRCRobo.twist(-1);
  58.                 VRCRobo.twist(1);
  59.             }
  60.             else if(label.equals("Animate")){
  61.                 VRCRobo.asyncAnimate();
  62.             }
  63.             else if(label.equals("Walk")){
  64.                 VRCRobo.asyncWalk();
  65.             }
  66.             else if(label.equals("Color")){
  67.                 VRCRobo.asyncColor();
  68.             }
  69.        }
  70.        return true;
  71.     }
  72. }
  73.  
  74.  
  75.