import java.awt.*; public class Controls extends java.awt.Panel{ // Builds up user interface panel private Button start,stop; private Label v; private TextField vbox; private Simulation simref; private Hyperion appletref; // Constructor for Controls Controls(Hyperion ref0, Simulation ref){ v = new Label("Initial speed = "); vbox = new TextField("6.284",6); start = new Button("Go"); stop = new Button("Pause"); add(start); add(stop); add(v); add(vbox); setBackground(Color.yellow); simref=ref; appletref=ref0; } // Watch for button clicks and suspend/resume simulation thread // accordingly // also text box stuff public boolean action(Event evt, Object arg){ double dx; if(evt.target instanceof Button){ if(arg.equals("Pause")) appletref.runner.suspend(); else if(arg.equals("Go")) appletref.runner.resume(); return true; } else if (evt.target instanceof TextField){ dx=(Double.valueOf(vbox.getText().trim())).doubleValue(); simref.setV(dx); return true; } return false; } }