A layout manager assists you in determining the size and position of the components within a container. Each container type has a default layout manager. BorderLayout is the default layout manager for the JFrame component. BorderLayout divides the container into five sections (north, south, east, west, and center). In this step, you switch to the GridLayout layout manager, which creates sections equal in size and displays them in the requested numbers of rows and columns.
To change layout managers:
The Layouts pane provides access to the layout managers in the Java Foundation Classes (JFC). When you move the pointer over a button in the toolbar, a tool tip displays the name of the layout manager.
The properties of the layout manager appear in the Properties pane of the Component Inspector.
Although the Form Designer does not display a grid, it now contains a single column and two rows.
Next: Adding a Label and Setting Its Properties
Back: Creating a Container |