Packages
 In this topic

*Constructors

*Methods

 

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

 


Class UIGroup

public class UIGroup extends UIPanel
{
  // Constructors
  public UIGroup();
  public UIGroup(String label);
  public UIGroup(IUIComponent header);

  // Methods
  public void adjustLayoutSize(IUIComponent comp,
        Dimension oldSize, Dimension newSize);
  public Insets getInsets();
  public boolean isWidthRelative();
  public void layout();
  public void paint(FxGraphics fxg);
  public void setName(String name);
}

This class implements a group box control. A group box is a control that consists of a rectangular frame and a label, and is used to organize other controls.

The following examples show the different ways to create UIGroup objects.

// Use the default constructor to create an empty
// group box, and the setName method to set its label.
UIGroup uigroup1 = new UIGroup();
uigroup1.setName("Direction");

// You can create the same group box with a different constructor.
UIGroup uigroup2 = new UIGroup("Direction");

// You can also use an IUIComponent for the
// group box's header. 
UIText header = new UIText("Direction", UIStatic.LEFT);
UIGroup uigroup3 = new UIGroup(header);

The UIGroup class uses a default UIVerticalFlowLayout to lay out components in the group box control. If you add certain components to the group box, such as a UIList object, no scroll bars are added to view the list (because the control is not contained in a UIScrollViewer), and the list may not be completely viewable.

However, simply adding a UIScrollViewer object does not help, because the layout is still a vertical flow layout. You must set the layout manager of the group box to something other than the default (to UIBorderLayout, for example).

The following example shows how to correctly add lists and other vertically scrollable components to a group box.

 // Create a list object to add to the UIGroup object
 list = new UIList(); 
 for(int loop = 0;loop < 150;loop++)
 {
      list.add("List " + loop);
 }

 // Add the list.
 uigroup4.setLayout(new UIBorderLayout());
 uigroup4.add("Center",new UIScrollViewer(list));
UIComponent
  |
  +--UIContainer
    |
    +--UIStateContainer
      |
      +--UIPanel
        |
        +--UIGroup

Constructors

UIGroup

public UIGroup();

Creates a UIGroup control with no label.

Remarks:

Use the setName method to add a label.

UIGroup

public UIGroup(String label);

Creates a group box control with the specified label.

ParameterDescription
label The label for the group control.

UIGroup

public UIGroup(IUIComponent header);

Creates a group box control using the specified component as a label.

ParameterDescription
header A IUIComponent label for the group control.

Methods

adjustLayoutSize

public void adjustLayoutSize(IUIComponent comp, Dimension oldSize,
        Dimension newSize);

Adjusts the layout size of the group box.

Return Value:

No return value.

ParameterDescription
comp The component contained by the UIGroup object whose preferred size has changed.
oldSize The previous layout size of the group box (in pixels).
newSize The new layout size of the group box (in pixels).

Remarks:

This method is automatically invoked when the container's size has changed.

getInsets

public Insets getInsets();

Retrieves the insets for the group box relative to its parent component, in pixels. This method is not called directly by the application. It is used in the layout method to lay out the group control relative to its parent component.

Return Value:

Returns a set of Insets for the group control.

isWidthRelative

public boolean isWidthRelative();

Determines if this layout manager uses the width of the container to lay out its children.

Return Value:

Returns true, signifying that this layout manager uses the container's width to lay out the children.

layout

public void layout();

This method is used to lay out the group box control.

Return Value:

No return value.

paint

public void paint(FxGraphics fxg);

Paints the group control.

Return Value:

No return value.

ParameterDescription
fxg The graphics context.

setName

public void setName(String name);

Sets the group box's displayed name.

Return Value:

No return value.

ParameterDescription
name The string that contains the name of the group control.

Overrides:

setName(String) in UIPanel.

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