The beginning of the run method is shown in Listing 4.
This is where things start to get interesting.
Listing 4. Beginning of the run method. |
---|
public void run(){ //This reference must be final because it is // referenced from within an anonymous class // definition. final World world = new World(200,300); //Get a reference to the JFrame object that // is used to display the World. JFrame frame = world.getFrame(); //Instantiate a new JButton object and // add it to the NORTH location in the // JFrame object. JButton button = new JButton( "Click to make a turtle."); frame.getContentPane().add( button,BorderLayout.NORTH); frame.pack();//VERY IMPORTANT |
File: ba.htm | [Next] | [Prev] |