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 ThreeBody appletref; private DrawSim plot; // Constructor for Controls Controls(ThreeBody ref0, Simulation ref, DrawSim p){ v = new Label("Mass of Jupiter = "); vbox = new TextField("0.0",6); start = new Button("Go"); stop = new Button("Pause"); add(start); add(stop); add(v); add(vbox); setBackground(Color.yellow); simref=ref; appletref=ref0; plot=p; } // 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.setGM_J(dx); plot.clearScreen(); return true; } return false; } }