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.
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.
PaneConstraint Variables
The constraint for a PaneConstraints
component that is
being added to a container consists of four variables:
CardLayout
).
The edge of the splitComponentName to which this component will be anchored.
Valid values are:
Select this | To do this |
---|---|
PaneConstraints.TOP |
This component will be above |
PaneConstraints.BOTTOM |
This component will be below |
PaneConstraints.RIGHT |
This component will be to the right of |
PaneConstraints.LEFT |
This component will be to the left of |
PaneConstraints.ROOT |
This component is the first component added. |
How Components are Added to PaneLayout
PaneConstraint
is its
name. Other components will use this value, specifying it as their
splitComponentName
.splitComponentName
as 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.
Creating a PaneLayout Container in the Java Visual Editor
layout
property to PaneLayout
. This allows you to access the PaneLayout
properties in the
Inspector.
PaneLayout
container. This component will
completely fill the container until you add another component.
Important: If the first component you added to a
PaneLayout
container was itself a container, the Java Visual Editor
assumes you are trying to add the second component to the outer
container instead of to the PaneLayout
container. Use
the component tree to specify to the containers that you want the
component to be placed in.
PaneLayout
, draw it
similarly to define its position relative to the other components.
For example, to split the right half of the container, begin drawing the third component starting from the middle of the right edge of the panel to the bottom right corner of the first component.
Copyright © 1997, 2004, Oracle. All rights reserved.