Packages
 In this topic

*Constructors

*Methods

*Fields

 

Packages   PreviousThis PackageNext
Package com.ms.ui   Previous This
Package
Next

 


Class UIBorderLayout

public class UIBorderLayout extends UILayoutManager
{
  // Fields
  public static final Integer BOTTOM;
  public static final Integer CENTER;
  public static final Integer EAST;
  public static final Integer LEFT;
  public static final Integer NORTH;
  public static final Integer RIGHT;
  public static final Integer SOUTH;
  public static final Integer TOP;
  public static final Integer WEST;

  // Constructors
  public UIBorderLayout();
  public UIBorderLayout(int hgap, int vgap);

  // Methods
  public void addLayoutComponent(IUIContainer cont,
        IUIComponent comp, Object constraints);
  public Dimension adjustLayoutSize(IUIContainer parent,
        Dimension oldParentSize, IUIComponent comp,
        Dimension oldSize, Dimension newSize);
  public Dimension getMinimumSize(IUIContainer parent);
  public Dimension getPreferredSize(IUIContainer parent);
  public boolean isOverlapping();
  public void layout(IUIContainer parent, Rectangle bounds);
  public IUIComponent navigate(IUIContainer cont,
        IUIComponent comp, int dir, boolean keyable);
  public void removeLayoutComponent(IUIContainer cont, IUIComponent
        comp);
}

This class implements an extended border layout manager. UIBorderLayout manages five layout components, identified as follows.

Layout Index Description
TOP The component at the top.
BOTTOM The component at the bottom.
LEFT The component at the left.
RIGHT The component at the right.
CENTER The component in the center.

UIBorderLayout lays out components in a manner similar to the AWT BorderLayout class.

UILayoutManager
  |
  +--UIBorderLayout

Constructors

UIBorderLayout

public UIBorderLayout();

Creates a border layout manager.

Remarks:

By default, the horizontal and vertical gaps (used for spacing between components) are 0 pixels each.

UIBorderLayout

public UIBorderLayout(int hgap, int vgap);

Creates a border layout manager using the specified horizontal and vertical gaps.

ParameterDescription
hgap The number of pixels used for horizontal spacing between components.
vgap The number of pixels used for vertical spacing between components.

Methods

addLayoutComponent

public void addLayoutComponent(IUIContainer cont, IUIComponent comp, Object
        constraints);

Adds the specified component to the container, according to the specified constraints.

Return Value:

No return value.

ParameterDescription
cont The container of the component.
comp The component to be added.
constraints Identifies where the component will be added. You can pass a String or Integer value, as described in the Remarks section.

Remarks:

This method is called by the container's add method. The following table lists possible values for the constraints parameter.

String value Integer value Component
CENTER 0 The component in the center.
TOP 1 The component at the top.
BOTTOM 2 The component at the bottom.
LEFT 2 The component at the left.
RIGHT 2 The component at the right.

The String values are not case-sensitive. If you pass null for this parameter, the component is added in the center.

Overrides:

addLayoutComponent(IUIContainer,IUIComponent,Object) in UILayoutManager.

Exceptions:

IllegalArgumentException if an undefined constraint was specified.

See Also: removeLayoutComponent

adjustLayoutSize

public Dimension adjustLayoutSize(IUIContainer parent,
        Dimension oldParentSize, IUIComponent comp, Dimension oldSize,
        Dimension newSize);

Called to adjust the layout size of the specified component in the specified container.

Return Value:

Returns a Dimension object containing the new preferred size of the container.

ParameterDescription
parent The container of the component.
oldParentSize The previous layout size of the container.
comp The component being sized.
oldSize The previous layout size of the component.
newSize The new layout size of the component.

Overrides:

adjustLayoutSize(IUIContainer,Dimension,IUIComponent,Dimension,Dimension) in UILayoutManager.

getMinimumSize

public Dimension getMinimumSize(IUIContainer parent);

Determines the minimum dimensions (in pixels) needed to lay out the components in the specified container.

Return Value:

Returns a Dimension object containing the minimum layout size.

ParameterDescription
parent The container of the components.

Remarks:

The width of the returned Dimension object is the sum of the minimum widths of the LEFT, RIGHT, and CENTER components, plus the horizontal gaps between the components and the container's left and right insets. The Dimension object's height is the sum of the minimum heights of the TOP and BOTTOM components, plus the largest of the minimum heights of the LEFT, RIGHT, and CENTER components, plus the vertical gaps and the container's top and bottom insets.

Overrides:

getMinimumSize(IUIContainer) in UILayoutManager.

See Also: getPreferredSize

getPreferredSize

public Dimension getPreferredSize(IUIContainer parent);

Determines the preferred dimensions (in pixels) for laying out the child components in the specified container.

Return Value:

Returns a Dimension object containing the preferred layout size.

ParameterDescription
parent The container of the components.

Remarks:

The width of the returned Dimension object is the sum of the preferred widths of the LEFT, RIGHT, and CENTER components, plus the horizontal gaps between the components. The Dimension object's height is the sum of the preferred heights of the TOP and BOTTOM components, plus the largest of the preferred heights of the LEFT, RIGHT, and CENTER components, plus the vertical gaps.

Overrides:

getPreferredSize(IUIContainer) in UILayoutManager.

See Also: getMinimumSize

isOverlapping

public boolean isOverlapping();

true if this layout manager lays out its children so Determines whether the components will overlap either completely or partially.

Return Value:

Returns true if the children overlap; otherwise, returns false. (The default is true.) Returning false also means that only the sibling floater window, if one exists, needs to be clipped by the manager.

Overrides:

isOverlapping() in UILayoutManager.

layout

public void layout(IUIContainer parent, Rectangle bounds);

Lays out the components in the specified container.

Return Value:

No return value.

ParameterDescription
parent The container being laid out.
bounds The bounding rectangle in which to lay out the components.

Remarks:

layout lays out the components in the following order:

Component Layout
TOP or NORTH Laid at the top of the bounding rectangle. The width of this component is set to the width of the bounding rectangle. The height is set to the component's preferred height.
BOTTOM or SOUTH Laid at the bottom of the bounding rectangle. The width of this component is set to the width of the bounding rectangle. The height is set to the component's preferred height.
LEFT or WEST Laid at the left of the bounding rectangle. The width of this component is set to its preferred width. The height is set to the height of the bounding rectangle minus the height of the TOP component, the height of the BOTTOM component, the vertical gap below the TOP component, and the vertical gap above the BOTTOM component.
RIGHT or EAST Laid at the right of the bounding rectangle. The width of this component is set to its preferred width. The height is set to the height of the bounding rectangle minus the height of the TOP component, the height of the BOTTOM component, the vertical gap below the TOP component, and the vertical gap above the BOTTOM component.
CENTER Laid in the center of the bounding rectangtle. The width of this component is set to the width of the bounding rectangle minus the widths of the LEFT and RIGHT components, and the horizontal gaps. The height is the height of the bounding rectangle minus the heights of the TOP and BOTTOM components, and the vertical gaps.

Overrides:

layout(IUIContainer,Rectangle) in UILayoutManager.

navigate

public IUIComponent navigate(IUIContainer cont, IUIComponent comp, int dir,
        boolean keyable);

Navigates from the specified component to another component in the specified direction.

Return Value:

Returns null, indicating that no component can be navigated to.

ParameterDescription
cont The container where the navigation is occurring.
comp The component to navigate from.
dir The navigation direction. Specify one of the NAVDIR values defined in the IUIAccessible interface. The following NAVDIR values are not supported, however.
  • NAVDIR_UP
  • NAVDIR_DOWN
  • NAVDIR_LEFT
  • NAVDIR_RIGHT
keyable If true, only components that are able to receive keyboard input can be navigated to; otherwise, all components can be navigated to.

Remarks:

This method is typically used to handle keyboard navigation in the container. However, UIBorderLayout does not provide this functionality.

Overrides:

navigate(IUIContainer,IUIComponent,int,boolean) in UILayoutManager.

removeLayoutComponent

public void removeLayoutComponent(IUIContainer cont, IUIComponent comp);

Removes the specified component from the container.

Return Value:

No return value.

ParameterDescription
cont The container of the component.
comp The component to be removed.

Remarks:

This method is called by the container's remove method.

Overrides:

removeLayoutComponent(IUIContainer,IUIComponent) in UILayoutManager.

See Also: addLayoutComponent

Fields

BOTTOM
The layout index for the bottom component.
CENTER
The layout index for the center component.
EAST
Note : Use RIGHT instead.
LEFT
The layout index for the left component.
NORTH
Note : Use TOP instead.
RIGHT
The layout index for the right component.
SOUTH
Note : Use BOTTOM instead.
TOP
The layout index for the top component.
WEST
Note : Use LEFT instead.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.