Web site layout - 698 Graphical User Interface Components: Part 1 Chapter
698 Graphical User Interface Components: Part 1 Chapter 12 67 68 application.setDefaultCloseOperation( 69 JFrame.EXIT_ON_CLOSE ); 70 } 71 72 } // end class BorderLayoutDemo Fig. 12.25 Demonstrating components in BorderLayout(part 3 of 3). Line 24 in the constructor defines a BorderLayout. The arguments specify the number of pixels between components that are arranged horizontally (horizontal gap space) and the number of pixels between components that are arranged vertically (vertical gap space), respectively. The default BorderLayoutconstructor supplies 0 pixels of gap space horizontally and vertically. Line 28 uses method setLayout to set the content pane s layout to layout. Adding Components to a BorderLayout requires a different add method from class Container, which takes two arguments the Component to add and the region in which the Component will be placed. For example, line 39 specifies that the buttons[0] should appear in the NORTH position. The components can be added in any order, but only one component can be added to each region. Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/7/01