import java.applet.*; import java.awt.*; public class Bifurcate extends Applet { private Image offImage; private BifurcateCanvas drawing; private BifurcateControl control; private Label status; private Button button; /* =========================================================== */ public void init() { setLayout(new BorderLayout()); button = new Button("Controls"); status = new Label("Bifurcation Diagram - Applet by B. Wachsmuth"); Panel bottomRow = new Panel(); bottomRow.setLayout(new FlowLayout()); bottomRow.add(status); bottomRow.add(button); add("South", bottomRow); int width = super.size().width; int height = super.size().height - bottomRow.preferredSize().height; offImage = createImage(width, height); // drawing = new BifurcateCanvas (this,offImage,width, height, // -0.1, 4.0, -0.1, 1.2, 100, 100); drawing = new BifurcateCanvas (this,offImage,width, height, -2, 0.4, -2, 2, 100, 100); add("Center", drawing); // control = new BifurcateControl(this,-0.1, 4.0, -0.1, 1.2, 100, 100); control = new BifurcateControl(this,-2, 0.4, -2, 2, 100, 100); resize(preferredSize()); show(); } /* =========================================================== */ public void showMsg(String msg) { status.setText(msg); } /* =========================================================== */ public void setControlParams(double xMin, double xMax, double yMin, double yMax, int iter, int pixel) { control.setParams(xMin,xMax,yMin,yMax,iter,pixel); } /* =========================================================== */ public void setDrawingParams(double xMin, double xMax, double yMin, double yMax, int iter, int pixel) { drawing.stop(); drawing.setParams(xMin,xMax,yMin,yMax,iter,pixel); drawing.start(); } /* =========================================================== */ public boolean action(Event e, Object arg) { if (e.target == button) { control.show(); control.toFront(); return true; } else return false; } }