Example
In a PaneLayout, the placement and size of each component is specified relative to the components that have already been added to the container. Each component specifies a PaneConstraints object that tells the layout manager from which component to take space, and how much of its existing space to take. Each component's PaneConstraints object is applied to the container as it existed at the time the component was added to the container. The order in which you add the components to the container is very important.
PaneConstraints.TOP | This component will be above splitComponentName. | |
PaneConstraints.BOTTOM | This component will be below splitComponentName. | |
PaneConstraints.RIGHT | This component will be to the right of splitComponentName. | |
PaneConstraints.LEFT | This component will be to the left of splitComponentName. | |
PaneConstraints.ROOT | This component is the first component added. |
For example,
If you want the splitter bar to be horizontal between an upper and lower half, drag the mouse starting from the top left corner to the middle of the right edge.
The layout manager will now split the space between the two components, giving the second component the area you defined, and giving the first component the rest of the frame or panel.
For example, to split the left half of the container, begin drawing the third component starting from the middle of the left edge of the panel to bottom left corner of the second component.
To do this,