| Package | org.aswing |
| Class | public class BorderLayout |
| Inheritance | BorderLayout EmptyLayout |
| Subclasses | FrameTitleBarLayout |
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:
Panel p = new Panel();
p.setLayout(new BorderLayout());
p.add(new Button("Okay"), BorderLayout.SOUTH);
For convenience, BorderLayout interprets the
absence of a string specification the same as the constant
CENTER:
Panel p2 = new Panel();
p2.setLayout(new BorderLayout());
p2.add(new TextArea()); // Same as p.add(new TextArea(), BorderLayout.CENTER);
The following image illustrate the way the borderLayout layout child component.
| Method | Defined by | ||
|---|---|---|---|
|
BorderLayout(hgap:int = 0, vgap:int = 0)
Constructs a border layout with the specified gaps
between components.
| BorderLayout | ||
|
addLayoutComponent(comp:Component, constraints:Object):void
| BorderLayout | ||
|
getHgap():int
| BorderLayout | ||
|
getLayoutAlignmentX(target:Container):Number
| BorderLayout | ||
|
getLayoutAlignmentY(target:Container):Number
| BorderLayout | ||
|
getVgap():int
| BorderLayout | ||
![]() |
invalidateLayout(target:Container):void
do nothing
| EmptyLayout | |
|
layoutContainer(target:Container):void
Lays out the container argument using this border layout. | BorderLayout | ||
![]() |
return IntDimension.createBigDimension();
| EmptyLayout | |
|
| BorderLayout | ||
|
| BorderLayout | ||
|
removeLayoutComponent(comp:Component):void
| BorderLayout | ||
|
setDefaultConstraints(constraints:Object):void
| BorderLayout | ||
|
setHgap(hgap:int):void
Set horizontal gap
| BorderLayout | ||
|
setVgap(vgap:int):void
Set vertical gap
| BorderLayout | ||
|
toString():String
| BorderLayout | ||
| Constant | Defined by | ||
|---|---|---|---|
| AFTER_LAST_LINE : String = "Last" [static]
| BorderLayout | ||
| AFTER_LINE_ENDS : String = "After" [static]
| BorderLayout | ||
| BEFORE_FIRST_LINE : String = "First" [static]
| BorderLayout | ||
| BEFORE_LINE_BEGINS : String = "Before" [static]
| BorderLayout | ||
| CENTER : String = "Center" [static]
The center layout constraint (middle of container).
| BorderLayout | ||
| EAST : String = "East" [static]
The east layout constraint (right side of container).
| BorderLayout | ||
| LINE_END : String = "After" [static]
| BorderLayout | ||
| LINE_START : String = "Before" [static]
| BorderLayout | ||
| NORTH : String = "North" [static]
The north layout constraint (top of container).
| BorderLayout | ||
| PAGE_END : String = "Last" [static]
| BorderLayout | ||
| PAGE_START : String = "First" [static]
| BorderLayout | ||
| SOUTH : String = "South" [static]
The south layout constraint (bottom of container).
| BorderLayout | ||
| WEST : String = "West" [static]
The west layout constraint (left side of container).
| BorderLayout | ||
| BorderLayout | () | constructor |
public function BorderLayout(hgap:int = 0, vgap:int = 0)
Constructs a border layout with the specified gaps
between components.
The horizontal gap is specified by hgap
and the vertical gap is specified by vgap.
hgap:int (default = 0) — hgap the horizontal gap.
|
|
vgap:int (default = 0) — vgap the vertical gap.
|
| addLayoutComponent | () | method |
public override function addLayoutComponent(comp:Component, constraints:Object):voidParameters
comp:Component |
|
constraints:Object |
| getHgap | () | method |
public function getHgap():int
Returns
int |
| getLayoutAlignmentX | () | method |
public override function getLayoutAlignmentX(target:Container):NumberParameters
target:Container |
Number |
| getLayoutAlignmentY | () | method |
public override function getLayoutAlignmentY(target:Container):NumberParameters
target:Container |
Number |
| getVgap | () | method |
public function getVgap():int
Returns
int |
| layoutContainer | () | method |
public override function layoutContainer(target:Container):void
Lays out the container argument using this border layout.
This method actually reshapes the components in the specified
container in order to satisfy the constraints of this
BorderLayout object. The NORTH
and SOUTH components, if any, are placed at
the top and bottom of the container, respectively. The
WEST and EAST components are
then placed on the left and right, respectively. Finally,
the CENTER object is placed in any remaining
space in the middle.
Most applications do not call this method directly. This method
is called when a container calls its doLayout method.
target:Container — target the container in which to do the layout.
|
See also
| minimumLayoutSize | () | method |
public override function minimumLayoutSize(target:Container):IntDimensionParameters
target:Container |
IntDimension |
| preferredLayoutSize | () | method |
public override function preferredLayoutSize(target:Container):IntDimensionParameters
target:Container |
IntDimension |
| removeLayoutComponent | () | method |
| setDefaultConstraints | () | method |
public function setDefaultConstraints(constraints:Object):voidParameters
constraints:Object |
| setHgap | () | method |
public function setHgap(hgap:int):voidSet horizontal gap
Parametershgap:int |
| setVgap | () | method |
public function setVgap(vgap:int):voidSet vertical gap
Parametersvgap:int |
| toString | () | method |
public function toString():String
Returns
String |
| AFTER_LAST_LINE | constant |
public static const AFTER_LAST_LINE:String = "Last"
| AFTER_LINE_ENDS | constant |
public static const AFTER_LINE_ENDS:String = "After"
| BEFORE_FIRST_LINE | constant |
public static const BEFORE_FIRST_LINE:String = "First"
| BEFORE_LINE_BEGINS | constant |
public static const BEFORE_LINE_BEGINS:String = "Before"
| CENTER | constant |
public static const CENTER:String = "Center"The center layout constraint (middle of container).
| EAST | constant |
public static const EAST:String = "East"The east layout constraint (right side of container).
| LINE_END | constant |
public static const LINE_END:String = "After"
| LINE_START | constant |
public static const LINE_START:String = "Before"
| NORTH | constant |
public static const NORTH:String = "North"The north layout constraint (top of container).
| PAGE_END | constant |
public static const PAGE_END:String = "Last"
| PAGE_START | constant |
public static const PAGE_START:String = "First"
| SOUTH | constant |
public static const SOUTH:String = "South"The south layout constraint (bottom of container).
| WEST | constant |
public static const WEST:String = "West"The west layout constraint (left side of container).