java.awt
Class BorderLayout
- LayoutManager, LayoutManager2, Serializable
This class implements a layout manager that positions components
in certain sectors of the parent container.
static String | AFTER_LAST_LINE - The constant indicating the position after the last line of the
layout.
|
static String | AFTER_LINE_ENDS - The constant indicating the position after the last item of the
layout.
|
static String | BEFORE_FIRST_LINE - The constant indicating the position before the first line of the
layout.
|
static String | BEFORE_LINE_BEGINS - The constant indicating the position before the first item of the
layout.
|
static String | CENTER - Constant indicating the center of the container
|
static String | EAST - Constant indicating the right side of the container
|
static String | LINE_END - The constant indicating the position after the last item of the
layout.
|
static String | LINE_START - The constant indicating the position before the first item of the
layout.
|
static String | NORTH - Constant indicating the top of the container
|
static String | PAGE_END - The constant indicating the position after the last line of the
layout.
|
static String | PAGE_START - The constant indicating the position before the first line of the
layout.
|
static String | SOUTH - Constant indicating the bottom of the container
|
static String | WEST - Constant indicating the left side of the container
|
BorderLayout() - Initializes a new instance of
BorderLayout with no
horiztonal or vertical gaps between components.
|
BorderLayout(int hgap, int vgap) - Initializes a new instance of
BorderLayout with the
specified horiztonal and vertical gaps between components.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
AFTER_LAST_LINE
public static final String AFTER_LAST_LINE
The constant indicating the position after the last line of the
layout. The exact position depends on the writing system: For a
top-to-bottom orientation, it is the same as
SOUTH
, for
a bottom-to-top orientation, it is the same as
NORTH
.
This constant is an older name for
PAGE_END
which
has exactly the same value.
AFTER_LINE_ENDS
public static final String AFTER_LINE_ENDS
The constant indicating the position after the last item of the
layout. The exact position depends on the writing system: For a
left-to-right orientation, it is the same as
EAST
, for
a right-to-left orientation, it is the same as
WEST
.
This constant is an older name for
LINE_END
which
has exactly the same value.
BEFORE_FIRST_LINE
public static final String BEFORE_FIRST_LINE
The constant indicating the position before the first line of the
layout. The exact position depends on the writing system: For a
top-to-bottom orientation, it is the same as
NORTH
, for
a bottom-to-top orientation, it is the same as
SOUTH
.
This constant is an older name for
PAGE_START
which
has exactly the same value.
BEFORE_LINE_BEGINS
public static final String BEFORE_LINE_BEGINS
The constant indicating the position before the first item of the
layout. The exact position depends on the writing system: For a
left-to-right orientation, it is the same as
WEST
, for
a right-to-left orientation, it is the same as
EAST
.
This constant is an older name for
LINE_START
which
has exactly the same value.
CENTER
public static final String CENTER
Constant indicating the center of the container
EAST
public static final String EAST
Constant indicating the right side of the container
LINE_END
public static final String LINE_END
The constant indicating the position after the last item of the
layout. The exact position depends on the writing system: For a
left-to-right orientation, it is the same as
EAST
, for
a right-to-left orientation, it is the same as
WEST
.
LINE_START
public static final String LINE_START
The constant indicating the position before the first item of the
layout. The exact position depends on the writing system: For a
left-to-right orientation, it is the same as
WEST
, for
a right-to-left orientation, it is the same as
EAST
.
NORTH
public static final String NORTH
Constant indicating the top of the container
PAGE_END
public static final String PAGE_END
The constant indicating the position after the last line of the
layout. The exact position depends on the writing system: For a
top-to-bottom orientation, it is the same as
SOUTH
, for
a bottom-to-top orientation, it is the same as
NORTH
.
PAGE_START
public static final String PAGE_START
The constant indicating the position before the first line of the
layout. The exact position depends on the writing system: For a
top-to-bottom orientation, it is the same as
NORTH
, for
a bottom-to-top orientation, it is the same as
SOUTH
.
SOUTH
public static final String SOUTH
Constant indicating the bottom of the container
WEST
public static final String WEST
Constant indicating the left side of the container
BorderLayout
public BorderLayout()
Initializes a new instance of BorderLayout
with no
horiztonal or vertical gaps between components.
BorderLayout
public BorderLayout(int hgap,
int vgap)
Initializes a new instance of BorderLayout
with the
specified horiztonal and vertical gaps between components.
hgap
- The horizontal gap between components.vgap
- The vertical gap between components.
addLayoutComponent
public void addLayoutComponent(Component component,
Object constraints)
Adds a component to the layout in the specified constraint position,
which must be one of the string constants defined in this class.
- addLayoutComponent in interface LayoutManager2
component
- The component to add.constraints
- The constraint string.
IllegalArgumentException
- If the constraint object is not
a string, or is not one of the specified constants in this class.
addLayoutComponent
public void addLayoutComponent(String constraints,
Component component)
This method is deprecated in favor of
addLayoutComponent(Component, Object)
.
Adds a component to the layout in the specified constraint position,
which must be one of the string constants defined in this class.
- addLayoutComponent in interface LayoutManager
constraints
- The constraint string.component
- The component to add.
getConstraints
public Object getConstraints(Component c)
Return the constraint corresponding to a component in this layout.
If the component is null, or is not in this layout, returns null.
Otherwise, this will return one of the constraint constants defined
in this class.
getHgap
public int getHgap()
Returns the horitzontal gap value.
- The horitzontal gap value.
getLayoutAlignmentX
public float getLayoutAlignmentX(Container parent)
Returns the X axis alignment, which is a float
indicating
where along the X axis this container wishs to position its layout.
0 indicates align to the left, 1 indicates align to the right, and 0.5
indicates align to the center.
- getLayoutAlignmentX in interface LayoutManager2
parent
- The parent container.
getLayoutAlignmentY
public float getLayoutAlignmentY(Container parent)
Returns the Y axis alignment, which is a float
indicating
where along the Y axis this container wishs to position its layout.
0 indicates align to the top, 1 indicates align to the bottom, and 0.5
indicates align to the center.
- getLayoutAlignmentY in interface LayoutManager2
parent
- The parent container.
getLayoutComponent
public Component getLayoutComponent(Container container,
Object constraints)
Return the component at the specified location, which must be one
of the absolute constants such as CENTER or SOUTH. The container's
orientation is used to map this location to the correct corresponding
component, so for instance in a right-to-left container, a request
for the EAST component could return the LINE_END component. This will
return null if no component is available at the given location.
container
- the container whose orientation is usedconstraints
- the absolute location of the component
- the component at the location, or null
getLayoutComponent
public Component getLayoutComponent(Object constraints)
Return the component at the indicated location, or null if no component
is at that location. The constraints argument must be one of the
location constants specified by this class.
constraints
- the location
- the component at that location, or null
getVgap
public int getVgap()
Returns the vertical gap value.
setHgap
public void setHgap(int hgap)
Sets the horizontal gap to the specified value.
hgap
- The new horizontal gap.
setVgap
public void setVgap(int vgap)
Sets the vertical gap to the specified value.
vgap
- The new vertical gap value.
toString
public String toString()
Returns a string representation of this layout manager.
- toString in interface Object
- A string representation of this object.
BorderLayout.java -- A layout manager class
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.