import java.applet.*; import java.awt.*; public class Mandel extends Applet { private Image offImage; private MandelCanvas drawing; private MandelControl control; private Label status; private Button button; /* =========================================================== */ public void init() { setLayout(new BorderLayout()); button = new Button("Controls"); status = new Label("Mandelbrot Set - 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 MandelCanvas (this,offImage,width, height, -2, 2, -2, 2, 50, 2); add("Center", drawing); control = new MandelControl(this,-2,2,-2,2,50,2); 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; } }