Example
BorderLayout is good for forcing components to one or more edges of a container, and for filling up the center of the container with a component. It is also the layout you want to use to cause a single component to completely fill its container.
You will probably find BorderLayout to be the most useful layout manager for the larger containers in your UI. By nesting a panel inside each area of the BorderLayout, then populating each of those panels with other panels of various layouts, you can achieve quite complicated UI designs.
For more information on using nested layouts, see Using nested panels and layouts.
Components are positioned in one of five areas within a BorderLayout, based on the constraints property. You can set the constraints property for the component in the Inspector to one of the following values: North, South, East, West, or Center.
For example, to put a tool bar across the top of a BorderLayout container, you could create a FlowLayout panel of buttons and place it in the North area of the container. You do this by selecting the panel and choosing North for its constraints property in the Inspector.
To set the constraints property,
Each of the five areas can contain only one component (or panel of components), so be careful when changing an existing container to BorderLayout.
By default, a BorderLayout puts no gap between the components it manages. However, you can use the Inspector to specify the horizontal or vertical gap in pixels for a layout associated with a container.
To modify the gap surrounding BorderLayout components, select the BorderLayout object in the Component Tree (displayed immediately below the container it controls), then modify the pixel value in the Inspector for the hgap and vgap properties.