Packages
 In this topic

*Constructors

*Methods

 

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

 


Class UIGridBagLayout

public class UIGridBagLayout extends UILayoutManager
{
  // Constructors
  public UIGridBagLayout();

  // Methods
  public void addLayoutComponent(IUIContainer cont,
        IUIComponent comp, Object constraints);
  public int getAlignment();
  public UIGridBagConstraints getConstraints(IUIComponent comp);
  public Dimension getMinimumSize(IUIContainer parent);
  public Dimension getPreferredSize(IUIContainer c,
        Rectangle parentRect, boolean pref);
  public Dimension getPreferredSize(IUIContainer parent);
  public Dimension getPreferredSize(IUIContainer parent,
        Rectangle rect);
  public void layout(IUIContainer c, Rectangle bounds,
        int alignment);
  public void layout(IUIContainer parent, Rectangle bounds);
  protected UIGridBagConstraints lookupConstraints(
        IUIComponent comp);
  public void setAlignment(int align);
  public void setConstraints(IUIComponent comp,
        UIGridBagConstraints cons);
  public void setConstraints(IUIComponent comp,
        GridBagConstraints cons);
}

This class implements a frame manager with a row by column format or grid for placing components. This class allows components of different sizes to be placed in a single container. The default alignment is centered.

Note A row will be as tall and as wide as the largest component. The class UIGridLayout is a much simpler version of the UIGridBagLayout. It does not allow variable row or column sizing. The following NAVDIR values are not supported in UIGridBagLayout.

  • NAVDIR_UP
  • NAVDIR_DOWN
  • NAVDIR_LEFT
  • NAVDIR_RIGHT

Also see com.ms.ui.UIGridLayout

UILayoutManager
  |
  +--UIGridBagLayout

Constructors

UIGridBagLayout

public UIGridBagLayout();

Creates a new instance of a UIGridBagLayout. Use addLayoutComponent to add components to the UIGridBagLayout container.

See Also: addLayoutComponent, com.ms.ui.UIGridBagConstraints

Methods

addLayoutComponent

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

Adds the specified component to the layout, using the specified constraint object.

Return Value:

No return value.

ParameterDescription
cont The container of the component.
comp The component to be added.
constraints Where or how the component is added to the layout.

Overrides:

addLayoutComponent(IUIContainer,IUIComponent,Object) in UILayoutManager.

Exceptions:

IllegalArgumentException if the constraints passed in are not proper UIGridBagConstraints.

See Also: com.ms.ui.UIGridBagConstraints

getAlignment

public int getAlignment();

Retrieves the current layout alignment.

Return Value:

Returns an integer indicating the alignment of the container's components. For a list of possible values, see setAlignment.

See Also: setAlignment

getConstraints

public UIGridBagConstraints getConstraints(IUIComponent comp);

Retrieves a copy of the constraints for the specified component.

Return Value:

Returns the constraints for the specified component.

ParameterDescription
comp The component to be queried.

getMinimumSize

public Dimension getMinimumSize(IUIContainer parent);

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

Return Value:

Returns a Dimension object containing the minimum layout size.

ParameterDescription
parent The container of the components.

Remarks:

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

Overrides:

getMinimumSize(IUIContainer) in UILayoutManager.

See Also: getPreferredSize

getPreferredSize

public Dimension getPreferredSize(IUIContainer c, Rectangle parentRect,
        boolean pref);

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

Return Value:

Returns a Dimension object containing the preferred layout size.

ParameterDescription
c The container of the components.
parentRect The bounding parent rectangle.
pref If set to true, getPreferredSize will be used; if set to false, getMinimumSize is used.

Remarks:

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

See Also: getMinimumSize, com.ms.ui.UIGridBagConstraints

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:

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

Overrides:

getPreferredSize(IUIContainer) in UILayoutManager.

See Also: getMinimumSize

getPreferredSize

public Dimension getPreferredSize(IUIContainer parent, Rectangle rect);

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.
rect The bounding rectangle.

Remarks:

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

See Also: getMinimumSize

layout

public void layout(IUIContainer c, Rectangle bounds, int alignment);

Lays out the components in the specified container. The grid of cells can be positioned within the container using alignment (see UIGridBagConstraints.anchor for values).

Return Value:

No return value.

ParameterDescription
c The container being laid out.
bounds The bounding rectangle in which to lay out the components.
alignment Specifies how to anchor the grid of cells within the container.

Remarks:

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

See Also: com.ms.ui.UIGridBagConstraings.anchor

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:

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

Overrides:

layout(IUIContainer,Rectangle) in UILayoutManager.

lookupConstraints

protected UIGridBagConstraints lookupConstraints(IUIComponent comp);

Retrieves the constraints for the specified component. The return value is not a copy, but is the actual constraints class used by the layout mechanism.

Return Value:

Returns the constraints for the specified component.

ParameterDescription
comp The component to be queried.

setAlignment

public void setAlignment(int align);

Sets the layout alignment.

Return Value:

No return value.

ParameterDescription
align The alignment for the container's components. See UIGridBagConstraints for possible anchor values.

See Also: getAlignment, com.ms.ui.UIGridBagConstraints

setConstraints

public void setConstraints(IUIComponent comp, UIGridBagConstraints cons);

Sets the constraints for the specified component.

Return Value:

No return value.

ParameterDescription
comp The component to be modified.
cons The constraints to be applied.

See Also: com.ms.ui.UIGridBagConstraints

setConstraints

public void setConstraints(IUIComponent comp, GridBagConstraints cons);

Sets the constraints for the specified component.

Return Value:

No return value.

ParameterDescription
comp The component to be modified.
cons The constraints to be applied.

See Also: com.ms.ui.UIGridBagConstraints

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