home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-03-04 | 2.0 KB | 75 lines |
- import java.awt.*;
- import java.applet.*;
- import VRCAPI;
- import VRCRobot;
-
- //class InitButton extends button{
- public class VRCJuice extends Applet
- {
- VRCRobot VRCRobo;
- boolean INIT = false;
-
- public void init()
- {
- setLayout(new GridLayout(1,3));
- add("a",new Button("Right Arm"));
- add("b",new Button("Right Leg"));
- add("c",new Button("Torso"));
- add("d",new Button("Left Leg"));
- add("e",new Button("Left Arm"));
- add("i",new Button("Color"));
- add("f",new Button("Animate"));
- add("h",new Button("Walk"));
- add("g",new Button("Restart"));
- }
-
- public void destroy()
- {
- VRCRobo.destroy();
- System.gc();
- INIT = false;
- }
-
- public boolean action(Event evt, Object arg)
- {
- if (evt.target instanceof Button){
- if (!INIT){
- VRCRobo = new VRCRobot();
- INIT = true;
- }
- String label = (String)arg;
- if (label.equals("Right Arm")){
- VRCRobo.asyncRWave();
- }
- else if(label.equals("Left Arm")){
- VRCRobo.asyncLWave();
- }
- else if(label.equals("Left Leg")){
- VRCRobo.asyncLLeg();
- }
- else if(label.equals("Right Leg")){
- VRCRobo.asyncRLeg();
- }
- else if(label.equals("Restart")){
- destroy();
- }
- else if(label.equals("Torso")){
- VRCRobo.twist(-1);
- VRCRobo.twist(1);
- }
- else if(label.equals("Animate")){
- VRCRobo.asyncAnimate();
- }
- else if(label.equals("Walk")){
- VRCRobo.asyncWalk();
- }
- else if(label.equals("Color")){
- VRCRobo.asyncColor();
- }
- }
- return true;
- }
- }
-
-
-