/** Henon..java: The Henon Attractor Feb. /98 * Daryl Rauhala Java Application */ import java.awt.*; import java.awt.event.*; public class Henon extends Frame { private PlotCanvas pc; // Canvas to plot points private InputPanel inputpanel; // panel for user input private Button Reset, UserInput; private Panel reset = new Panel(); private Panel userInput = new Panel(); private Panel main = new Panel(); public Henon(String title) { super(title); setBounds(0,0,450,400); // set bounds of the Frame pc = new PlotCanvas(); pc.setBackground(Color.pink); pc.setBounds(0,15,450,300); // can set Canvas size as desired pc.setHenonDefaults(); add(pc, BorderLayout.CENTER ); // istantiate the Panel of input varibales inputpanel = new InputPanel(); // want it to listen to the two buttons within InputPanel // Buttons are Reset and Draw with Your Variables // could create the buttons here and separate from the InputPanel reset.setLayout (new GridLayout(1,1, 0,0)); // new Panel Reset = new Button ( "Reset to Defaults" ); reset.add( Reset , BorderLayout.WEST ); userInput.setLayout (new GridLayout(1,1, 0,0)); // new Panel UserInput = new Button ( "Redraw with your Input Variables" ); userInput.add( UserInput, BorderLayout.EAST ); main.setLayout (new BorderLayout() ); // new Panel main.add (reset, BorderLayout.NORTH ); main.add (userInput, BorderLayout.SOUTH); main.add (inputpanel, BorderLayout.CENTER ); add (main, BorderLayout.SOUTH); // register listener for the input variables UserInput.addActionListener( new InputPanelHandler( pc, inputpanel ) ); // register listener for the reset Button Reset.addActionListener ( new InputPanelHandler( pc, inputpanel ) ); // register listener for the close button of the Frame this.addWindowListener ( new WindowCloseHandler() ); // register the Mouse listener to the PlotCanvas pc.addMouseListener ( new ZoomHandler( pc, inputpanel ) ); } // end of the Henon Constructor /** * Make the actual call to start the application */ public static void main(String args[]) { Frame app = new Henon("Henon Attractor"); app.setVisible(true); // would be nice to see the Frame app.pack(); // subcomponents are laid out at // their perferred size } }