A border layout lays out a container, arranging and resizing
its components to fit in five regions:
north, south, east, west, and center.
Each region may contain no more than one component, and
is identified by a corresponding constant:
NORTH
, SOUTH
, EAST
,
WEST
, and CENTER
. When adding a
component to a container with a border layout, use one of these
five constants, for example:
var p: JPanel = new JPanel();
p.setLayout(new BorderLayout());
p.append(new JButton("Ok"), BorderLayout.SOUTH);
For convenience,
BorderLayout
interprets the
absence of a string specification the same as the constant
CENTER
:
var p2: JPanel = new JPanel();
p2.setLayout(new BorderLayout());
p2.append(new TextArea()); // Same as p.add(new TextArea(), BorderLayout.CENTER);
The following image illustrate the way the borderLayout layout child component.
Authors paling, ngrebenshikov
Class Fields
Instance Fields