com.sun.lwuit.layouts
Class BorderLayout

java.lang.Object
  extended by com.sun.lwuit.layouts.Layout
      extended by com.sun.lwuit.layouts.BorderLayout

public class BorderLayout
extends Layout

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.


Field Summary
static java.lang.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 availble 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 java.lang.String EAST
          The east layout constraint (right of container).
static java.lang.String NORTH
          The north layout constraint (top of container).
static java.lang.String SOUTH
          The south layout constraint (bottom of container).
static java.lang.String WEST
          The west layout constraint (left of container).
 
Constructor Summary
BorderLayout()
          Creates a new instance of BorderLayout
 
Method Summary
 void addLayoutComponent(java.lang.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(java.lang.String portraitPosition, java.lang.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(java.lang.Object o)
           
 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
 java.lang.Object getComponentConstraint(Component comp)
          Returns the component constraint
 Component getEast()
          Returns the component in the east location
 java.lang.String getLandscapeSwap(java.lang.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
 void layoutContainer(Container target)
          Layout the given parent container children
 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
 java.lang.String toString()
           
 
Methods inherited from class com.sun.lwuit.layouts.Layout
hashCode, isOverlapSupported
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CENTER_BEHAVIOR_SCALE

public static final 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

See Also:
Constant Field Values

CENTER_BEHAVIOR_CENTER

public static final 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 availble to the center component.

See Also:
Constant Field Values

CENTER_BEHAVIOR_CENTER_ABSOLUTE

public static final 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

See Also:
Constant Field Values

NORTH

public static final java.lang.String NORTH
The north layout constraint (top of container).

See Also:
Constant Field Values

SOUTH

public static final java.lang.String SOUTH
The south layout constraint (bottom of container).

See Also:
Constant Field Values

CENTER

public static final java.lang.String CENTER
The center layout constraint (middle of container)

See Also:
Constant Field Values

WEST

public static final java.lang.String WEST
The west layout constraint (left of container).

See Also:
Constant Field Values

EAST

public static final java.lang.String EAST
The east layout constraint (right of container).

See Also:
Constant Field Values
Constructor Detail

BorderLayout

public BorderLayout()
Creates a new instance of BorderLayout

Method Detail

addLayoutComponent

public void addLayoutComponent(java.lang.Object name,
                               Component comp,
                               Container c)
Description copied from class: Layout
Some layouts can optionally track the addition of elements with meta-data that allows the user to "hint" on object positioning.

Overrides:
addLayoutComponent in class Layout
Parameters:
name - optional meta data information, like alignment orientation
comp - the added component to the layout
c - the parent container

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Description copied from class: Layout
Removes the component from the layout this operation is only useful if the layout maintains references to components within it

Overrides:
removeLayoutComponent in class Layout
Parameters:
comp - the removed component from layout

getComponentConstraint

public java.lang.Object getComponentConstraint(Component comp)
Returns the component constraint

Overrides:
getComponentConstraint in class Layout
Parameters:
comp - the component whose constraint is queried
Returns:
one of the constraints defined in this class

layoutContainer

public void layoutContainer(Container target)
Description copied from class: Layout
Layout the given parent container children

Specified by:
layoutContainer in class Layout
Parameters:
target - the given parent container

getPreferredSize

public Dimension getPreferredSize(Container parent)
Description copied from class: Layout
Returns the container preferred size

Specified by:
getPreferredSize in class Layout
Parameters:
parent - the parent container
Returns:
the container preferred size

getSouth

public Component getSouth()
Returns the component in the south location

Returns:
the component in the constraint

getCenter

public Component getCenter()
Returns the component in the center location

Returns:
the component in the constraint

getNorth

public Component getNorth()
Returns the component in the north location

Returns:
the component in the constraint

getEast

public Component getEast()
Returns the component in the east location

Returns:
the component in the constraint

getWest

public Component getWest()
Returns the component in the west location

Returns:
the component in the constraint

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

defineLandscapeSwap

public void defineLandscapeSwap(java.lang.String portraitPosition,
                                java.lang.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.

Parameters:
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 landscape

getLandscapeSwap

public java.lang.String getLandscapeSwap(java.lang.String portraitPosition)
Returns the landscape swap destination for the given border layout element if such a destination is defined.

Parameters:
portraitPosition - the constraint used when placing the component
Returns:
the constraint to use when in landscape or null if undefined

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class Layout

isAbsoluteCenter

public boolean isAbsoluteCenter()
Deprecated. use center behavior instead

Indicates that the center shouldn't grow and should be placed exactly in the center of the layout

Returns:
the absoluteCenter

setAbsoluteCenter

public void setAbsoluteCenter(boolean absoluteCenter)
Deprecated. use center behavior instead

Indicates that the center shouldn't grow and should be placed exactly in the center of the layout

Parameters:
absoluteCenter - the absoluteCenter to set

getCenterBehavior

public int getCenterBehavior()
Defines the behavior of the center component to one of the constants defined in this class

Returns:
the centerBehavior

setCenterBehavior

public void setCenterBehavior(int centerBehavior)
Defines the behavior of the center component to one of the constants defined in this class

Parameters:
centerBehavior - the centerBehavior to set