public class BorderLayout extends Layout
Modifier and Type | Field and Description |
---|---|
static String |
CENTER
The center layout constraint (middle of container)
|
static int |
CENTER_BEHAVIOR_CENTER
Defines the behavior of the component placed in the center position of the layout, places the component in the center of
the space available to the center component.
|
static int |
CENTER_BEHAVIOR_CENTER_ABSOLUTE
Defines the behavior of the component placed in the center position of the layout, places the component in the center of
the surrounding container
|
static int |
CENTER_BEHAVIOR_SCALE
Defines the behavior of the component placed in the center position of the layout, by default it is scaled to the available space
|
static int |
CENTER_BEHAVIOR_TOTAL_BELLOW
Deprecated due to spelling mistake, use CENTER_BEHAVIOR_TOTAL_BELOW
The center component takes up the entire screens and the sides are automatically placed on top of it thus creating
a layered effect
|
static int |
CENTER_BEHAVIOR_TOTAL_BELOW
Deprecated due to spelling mistake, use CENTER_BEHAVIOR_TOTAL_BELOW
The center component takes up the entire screens and the sides are automatically placed on top of it thus creating
a layered effect
|
static String |
EAST
The east layout constraint (right of container).
|
static String |
NORTH
The north layout constraint (top of container).
|
static String |
SOUTH
The south layout constraint (bottom of container).
|
static String |
WEST
The west layout constraint (left of container).
|
Constructor and Description |
---|
BorderLayout()
Creates a new instance of BorderLayout
|
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(Object name,
Component comp,
Container c)
Some layouts can optionally track the addition of elements with meta-data
that allows the user to "hint" on object positioning.
|
void |
defineLandscapeSwap(String portraitPosition,
String landscapePosition)
This method allows swapping positions within the border layout when the layout
orientation changes to landscape or if the layout starts off as landscape.
|
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one.
|
Component |
getCenter()
Returns the component in the center location
|
int |
getCenterBehavior()
Defines the behavior of the center component to one of the constants defined in this class
|
Object |
getComponentConstraint(Component comp)
Returns the component constraint
|
Component |
getEast()
Returns the component in the east location
|
String |
getLandscapeSwap(String portraitPosition)
Returns the landscape swap destination for the given border layout element if such
a destination is defined.
|
Component |
getNorth()
Returns the component in the north location
|
Dimension |
getPreferredSize(Container parent)
Returns the container preferred size
|
Component |
getSouth()
Returns the component in the south location
|
Component |
getWest()
Returns the component in the west location
|
boolean |
isAbsoluteCenter()
Deprecated.
use center behavior instead
|
boolean |
isConstraintTracking()
If this method returns true, the addLayoutComponent method will be called when replacing a
layout for every component within the container
|
boolean |
isOverlapSupported()
This method returns true if the Layout allows Components to
Overlap.
|
boolean |
isScaleEdges()
Stretches the edge components (NORTH/EAST/WEST/SOUTH)
|
void |
layoutContainer(Container target)
Layout the given parent container children
|
boolean |
obscuresPotential(Container parent)
Some layout managers can obscure their child components in some cases this
returns true if the basic underpinnings are in place for that.
|
void |
removeLayoutComponent(Component comp)
Removes the component from the layout this operation is only useful if the
layout maintains references to components within it
|
void |
setAbsoluteCenter(boolean absoluteCenter)
Deprecated.
use center behavior instead
|
void |
setCenterBehavior(int centerBehavior)
Defines the behavior of the center component to one of the constants defined in this class
|
void |
setScaleEdges(boolean scaleEdges)
Stretches the edge components (NORTH/EAST/WEST/SOUTH)
|
String |
toString()
Returns a string representation of the object.
|
public static final int CENTER_BEHAVIOR_SCALE
public static final int CENTER_BEHAVIOR_CENTER
public static final int CENTER_BEHAVIOR_CENTER_ABSOLUTE
public static final int CENTER_BEHAVIOR_TOTAL_BELLOW
public static final int CENTER_BEHAVIOR_TOTAL_BELOW
public static final String NORTH
public static final String SOUTH
public static final String CENTER
public static final String WEST
public static final String EAST
public void addLayoutComponent(Object name, Component comp, Container c)
Layout
addLayoutComponent
in class Layout
name
- optional meta data information, like alignment orientationcomp
- the added component to the layoutc
- the parent containerpublic void removeLayoutComponent(Component comp)
Layout
removeLayoutComponent
in class Layout
comp
- the removed component from layoutpublic Object getComponentConstraint(Component comp)
getComponentConstraint
in class Layout
comp
- the component whose constraint is queriedpublic void layoutContainer(Container target)
Layout
layoutContainer
in class Layout
target
- the given parent containerpublic Dimension getPreferredSize(Container parent)
Layout
getPreferredSize
in class Layout
parent
- the parent containerpublic Component getSouth()
public Component getCenter()
public Component getNorth()
public Component getEast()
public Component getWest()
public String toString()
Object
public void defineLandscapeSwap(String portraitPosition, String landscapePosition)
portraitPosition
- the position for the component when in portrait (this position
should always be used when adding a component to the layout). One of NORTH/SOUTH/EAST/WEST/CENTER.landscapePosition
- the destination position to use in landscapepublic String getLandscapeSwap(String portraitPosition)
portraitPosition
- the constraint used when placing the componentpublic boolean equals(Object o)
Object
public boolean isAbsoluteCenter()
public void setAbsoluteCenter(boolean absoluteCenter)
absoluteCenter
- the absoluteCenter to setpublic int getCenterBehavior()
public void setCenterBehavior(int centerBehavior)
centerBehavior
- the centerBehavior to setpublic boolean isOverlapSupported()
Layout
isOverlapSupported
in class Layout
public boolean isScaleEdges()
public void setScaleEdges(boolean scaleEdges)
scaleEdges
- the scaleEdges to setpublic boolean isConstraintTracking()
Layout
isConstraintTracking
in class Layout
public boolean obscuresPotential(Container parent)
Layout
obscuresPotential
in class Layout
parent
- parent container