This is a feature of JBuilder Professional and Enterprise.
PaneLayout
allows you to specify the size of a component in relation to its sibling components. PaneLayout
applied to a panel or frame lets you control the percentage of the container the components will have relative to each other but does not create moveable splitter bars between the panes.
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
component that is being added to a container consists of four variables:
name
CardLayout
).
splitComponentName
position
splitComponentName
to which this component will be anchored.
Valid values are:
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.
proportion
splitComponentName
that will be allocated to this component. A number between 0 and 1.
PaneLayout
adds components to the container in the following manner:
PaneConstraint
is its name
, so the other components have a value to specify as their splitComponentName
.
splitComponentName
. The only choice is the name
of the first component.
splitComponentName
of subsequent components may be the name
of any component that has already been added to the container.
PaneLayout
container,
layout
property to PaneLayout
. This allows you to access the PaneLayout
properties in the Inspector and change the width of the splitter bars.
PaneLayout
container. This component will completely fill up the container until you add another component to split this one.
For example,
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.
PaneLayout
container was itself a
container, the UI designer assumes you are trying to add the second component to the outer container instead of to the PaneLayout
container. To specify to the UI designer that you want to add components to containers other than those at the top of the Z-order, select the target container, then hold down the Ctrl key while clicking or dragging the component in the UI designer.
PaneLayout
, draw it similarly to define its relative position to the other components.
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.
splitComponent
edge a component should be anchored to and the proportion of the splitComponent
this component should occupy.
To do this,
constraints
property, then click the ellipsis button