This section teaches you how to select a layout manager from the Component Palette and modify its default properties using the Component Inspector.
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 tab provides access to the layout managers in the Java Foundation Classes (JFC). When you move your mouse pointer over a button in the layouts toolbar, a tool tip displays the name of the layout manager represented by that button.
The GridLayout is added in the component hierarchy of the Component Inspector.
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 |
See Also | |
---|---|
Working With Layouts
Component Palette Component Inspector |