import java.awt.*; class Control extends Panel { MyCanvas canvas; Control(MyCanvas canvas) { setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10)); this.canvas = canvas; add(new Button("Fast")); add(new Button("Slow")); } //--------------------------------------------------------------------- //void init() { // addNotify(); // resize(preferredSize()); //} //--------------------------------------------------------------------- public boolean action(Event ev, Object arg) { if (ev.target instanceof Button) { if ("Fast".equals(arg)) { canvas.goFast(); } else /*if ("Slow".equals(arg))*/ { canvas.goSlow(); } return true; } return false; } }