Packages
 In this topic

*Constructors

*Methods

 

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

 


Class UIPanel

public class UIPanel extends UIStateContainer
{
  // Constructors
  public UIPanel();
  public UIPanel(int edge);

  // Methods
  public IUIComponent add(IUIComponent comp, Object constraints,
        int index);
  public IUIComponent getChild(int index);
  public Rectangle getChildBounds(IUIComponent child);
  public Rectangle getChildBounds(int index);
  public int getChildCount();
  public Point getChildLocation(IUIComponent child);
  public Point getChildLocation(int index);
  public Dimension getChildSize(IUIComponent child);
  public Dimension getChildSize(int index);
  public IUIComponent getComponent(int index);
  public int getComponentCount();
  public IUIComponent getHeader();
  public int getID();
  public IUILayoutManager getLayout();
  public String getName();
  public int getRoleCode();
  public boolean move(IUIComponent comp, IUIComponent before);
  public boolean move(int from, int to);
  public void paintAll(FxGraphics g);
  public void remove(int index);
  public void setChildBounds(IUIComponent child, int x, int y,
        int width, int height);
  public void setChildBounds(int index, int x, int y, int width,
        int height);
  public void setChildBounds(int index, Rectangle rect);
  public void setChildLocation(IUIComponent child, int x, int y);
  public void setChildLocation(int index, int x, int y);
  public void setChildLocation(int index, Point point);
  public void setChildSize(IUIComponent child, int width,
        int height);
  public void setChildSize(int index, int width, int height);
  public void setChildSize(int index, Dimension size);
  public void setHeader(IUIComponent header);
  public void setID(int id);
  public void setLayout(IUILayoutManager lm);
  public void setName(String name);
  public void setRedrawing(boolean on);
}

This class implements a container for multiple components. A UIPanel object can contain both child items and a header component, where the header represents the container itself. For example, a tree control's header component is the item displayed by the tree node itself; items displayed below the node are child items. Many UIPanel containers, however, do not have a header component (such as a list control). Other types of containers, specifically UISingleContainer objects, contain only a header component and no child components. For example, the text displayed on a button is its header; however, the button has no children.

UIPanel provides the getHeader and setHeader methods to retrieve and set the current header component. You can insert child components with add.

Note The preferred width of a sub-class of UIPanel does not include the preferred width of the sub-classes's header text. This is similar to a top level window's preferred width not including the preferred width of the window's caption text. Hence, when the largest component in a UIPanel shrinks, the UIPanel also shrinks.

The following diagram shows the classes that extend UIPanel.

UIPanel
|
+--UIChoice
|
+--UIGroup
|
+--UIRoot
|
+--UIRow
|
+--UIScroll
|
+--UIScrollViewer
|
+--UISelector
|
+--UISplitViewer
|
+--UITabViewer
|
+--UIViewer
UIComponent
  |
  +--UIContainer
    |
    +--UIStateContainer
      |
      +--UIPanel

Constructors

UIPanel

public UIPanel();

Creates a UIPanel container with no edge.

Remarks:

By default, the container uses UIFlowLayout for its layout manager.

UIPanel

public UIPanel(int edge);

Creates a UIPanel container with the specified edge.

ParameterDescription
edge The style of the panel's edge. You can pass one of the following values.

Remarks:

By default, the panel uses UIFlowLayout for its layout manager.

Exceptions:

IllegalArgumentException if an undefined edge style was specified.

Methods

add

public IUIComponent add(IUIComponent comp, Object constraints, int index);

Adds the specified component to the panel, according to the specified constraints and index.

Return Value:

Returns the component that was added, if successful; otherwise, returns null.

ParameterDescription
comp The component to be added.
constraints The layout constraints, which depend on the current layout manager. For more information about possible values, see the layout manager's addLayoutComponent method.
index The zero-based index at which to insert the component. If the panel has a header component, the header is at index 0, and the first child begins at index 1. Otherwise, the first child begins at index 0. To add the component at the end of the panel, pass -1. (For more information about headers, see the UIPanel overview.)

Remarks:

Other versions of add are inherited from UIContainer.

Overrides:

add(IUIComponent,Object,int) in UIStateContainer.

Exceptions:

ArrayIndexOutOfBoundsException if an invalid index was specified.

See Also: remove

getChild

public IUIComponent getChild(int index);

Retrieves the child component at the specified index. The header component cannot be retrieved through getChild.

Return Value:

Returns the specified component, if found; otherwise, returns null.

ParameterDescription
index The zero-based index of the component to be retrieved. Regardless of whether the panel has a header component, the first child component is at index 0.

Exceptions:

ArrayIndexOutOfBoundsException if an invalid index was specified.

See Also: getComponent, getChildCount

getChildBounds

public Rectangle getChildBounds(IUIComponent child);

Retrieves the bounding rectangle of the specified component.

Return Value:

Returns a Rectangle object identifying the component's bounding area, if successful; otherwise, returns null.

ParameterDescription
child The component. Specify either the panel's header component or any child component.

See Also: setChildSize

getChildBounds

public Rectangle getChildBounds(int index);

Retrieves the bounding rectangle of the component at the specified index.

Return Value:

Returns a Rectangle object identifying the component's bounding area, if successful; otherwise, returns null.

ParameterDescription
index The zero-based index of the component. If the panel has a header component, the header is at index 0 and the first child component begins at index 1. Otherwise, the first child begins at index 0.

Exceptions:

ArrayIndexOutOfBoundsException if an invalid index is used.

See Also: setChildBounds

getChildCount

public int getChildCount();

Retrieves the number of components in the panel, excluding the header component.

Return Value:

Returns the number of child components.

See Also: getComponentCount, getChild

getChildLocation

public Point getChildLocation(IUIComponent child);

Retrieves the location of the specified component.

Return Value:

Returns a Point object that contains the upper-left corner of the component, if successful; otherwise, returns null.

ParameterDescription
child The component. Specify either the panel's header component or any child component.

See Also: setChildLocation

getChildLocation

public Point getChildLocation(int index);

Retrieves the location of the component at the specified index.

Return Value:

Returns a Point object that contains the upper-left corner of the component, if successful; otherwise, returns null.

ParameterDescription
index The zero-based index of the component. If the panel has a header component, the header is at index 0 and the first child component begins at index 1. Otherwise, the first child begins at index 0.

Exceptions:

ArrayIndexOutOfBoundsException if the index is invalid.

See Also: setChildLocation

getChildSize

public Dimension getChildSize(IUIComponent child);

Retrieves the size (in pixels) of the specified component.

Return Value:

Returns a Dimension object that contains the component's dimensions, if successful; otherwise, returns null.

ParameterDescription
child The component. Specify either the panel's header component or any child component.

Exceptions:

ArrayIndexOutOfBoundsException if an invalid index is used.

See Also: setChildSize

getChildSize

public Dimension getChildSize(int index);

Retrieves the size (in pixels) of the component at the specified index.

Return Value:

Returns a Dimension object containing the component's dimensions.

ParameterDescription
index The zero-based index of the component. If the panel has a header component, the header is at index 0 and the first child component begins at index 1. Otherwise, the first child begins at index 0.

See Also: setChildSize

getComponent

public IUIComponent getComponent(int index);

Retrieves the component at the specified index in the panel.

Return Value:

Returns the specified component, if found; otherwise, returns null.

ParameterDescription
index The zero-based index of the component to be retrieved. If the panel has a header component, the header is at index 0, and the first child begins at index 1. Otherwise, the first child begins at index 0.

Exceptions:

ArrayIndexOutOfBoundsException if an invalid index was specified.

See Also: getChild, getComponentCount

getComponentCount

public int getComponentCount();

Retrieves the number of components in the panel, including the header component.

Return Value:

Returns the total number of components.

See Also: getChildCount, getComponent

getHeader

public IUIComponent getHeader();

Retrieves the panel's header component.

Return Value:

Returns the current header component (if the panel has a header); otherwise, returns null. For more information about headers, see the UIPanel overview.

See Also: setHeader

getID

public int getID();

Retrieves the panel's identifier.

Return Value:

Returns the integer associated with the panel.

See Also: setID, getName

getLayout

public IUILayoutManager getLayout();

Retrieves the layout manager of the panel.

Return Value:

Returns the current layout manager (if the panel has a layout manager); otherwise, returns null.

See Also: setLayout

getName

public String getName();

Retrieves the panel's name.

Return Value:

Returns the String that displays the panel's associated name.

See Also: setName, getID

getRoleCode

public int getRoleCode();

Retrieves the panel's Microsoft® Active Accessibility™ role code.

Return Value:

Returns the ROLE_SYSTEM_PANE role code.

move

public boolean move(IUIComponent comp, IUIComponent before);

Moves a component in the panel in front of the specified component.

Return Value:

Returns true if the component was moved successfully; otherwise, returns false.

ParameterDescription
comp The component to move.
before The component identifying the position that comp will be placed in front of. If null, comp is placed at the end of the panel.

Remarks:

The parameters comp and before can be either a child component or the header component.

Exceptions:

IllegalArgumentException if either comp or before is not an immediate child of the panel.

move

public boolean move(int from, int to);

Moves a component in the panel, according to the specified indices.

Return Value:

Returns true if the component was moved successfully; otherwise, returns false.

ParameterDescription
from The zero-based index of the component to move.
to The zero-based index of the position that the component will be placed in front of. To move the component to the end of the panel, pass -1.

Remarks:

If the panel has a header component, the header is at index 0 and the first child begins at index 1. Otherwise, the first child begins at index 0.

Exceptions:

IllegalArgumentException if an invalid index was specified.

paintAll

public void paintAll(FxGraphics g);

Draws the panel and all of its child components, using the specified graphics context.

Return Value:

No return value.

ParameterDescription
g The graphics context.

Remarks:

If the panel's redrawing state is set, this method draws the panel and its child components. If the redrawing state is cleared, paintAll adds the clipping region to the invalid region.

See Also: setRedrawing

remove

public void remove(int index);

Removes the component at the specified index from the panel.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component to be removed. If the panel has a header component, the header is at index 0 and the first child begins at index 1. Otherwise, the first child begins at index 0.

Overrides:

remove(int) in UIStateContainer.

setChildBounds

public void setChildBounds(IUIComponent child, int x, int y, int width, int
        height);

Sets the bounds of the specified component, according to the specified coordinates and dimensions.

Return Value:

No return value.

ParameterDescription
child The component. Specify either the panel's header component or any child component.
x The x coordinate for the upper-left corner of the component.
y The y coordinate for the upper-left corner of the component.
width The width for the component (in pixels).
height The height for the component (in pixels).

See Also: getChildBounds

setChildBounds

public void setChildBounds(int index, int x, int y, int width, int height);

Sets the bounds of the component at the specified index, according to the specified coordinates and dimensions.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the panel has a header component, the header is at index 0 and the first child component begins at index 1. Otherwise, the first child begins at index 0.
x The x coordinate for the upper-left corner of the component.
y The y coordinate for the upper-left corner of the component.
width The width for the component (in pixels).
height The height for the component (in pixels).

See Also: getChildBounds

setChildBounds

public void setChildBounds(int index, Rectangle rect);

Sets the bounds of the component at the specified index, according to the specified Rectangle object.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the panel has a header component, the header is at index 0 and the first child component begins at index 1. Otherwise, the first child begins at index 0.
rect The bounding rectangle for the component.

See Also: getChildBounds

setChildLocation

public void setChildLocation(IUIComponent child, int x, int y);

Sets the location of the specified component, according to the specified coordinates.

Return Value:

No return value.

ParameterDescription
child The component. Specify either the panel's header component or any child component.
x The x coordinate for the upper-left corner of the component.
y The y coordinate for the upper-left corner of the component.

See Also: getChildLocation

setChildLocation

public void setChildLocation(int index, int x, int y);

Sets the location of the component at the specified index, according to the specified coordinates.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the panel has a header component, the header is at index 0 and the first child component begins at index 1. Otherwise, the first child begins at index 0.
x The x coordinate for the upper-left corner of the component.
y The y coordinate for the upper-left corner of the component.

See Also: getChildLocation

setChildLocation

public void setChildLocation(int index, Point point);

Sets the location of the component at the specified index, according to the specified Point object.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the panel has a header component, the header is at index 0 and the first child component begins at index 1. Otherwise, the first child begins at index 0.
point The upper-left corner of the component.

See Also: getChildLocation

setChildSize

public void setChildSize(IUIComponent child, int width, int height);

Sets the size of the specified component, according to the specified dimensions.

Return Value:

No return value.

ParameterDescription
child The component. Specify either the panel's header component or any child component.
width The width for the component (in pixels).
height The height for the component (in pixels).

See Also: getChildSize

setChildSize

public void setChildSize(int index, int width, int height);

Sets the size of the component at the specified index, according to the specified dimensions.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the panel has a header component, the header is at index 0 and the first child component begins at index 1. Otherwise, the first child begins at index 0.
width The width for the component (in pixels).
height The height for the component (in pixels).

See Also: getChildSize

setChildSize

public void setChildSize(int index, Dimension size);

Sets the size of the component at the specified index, according to the specified Dimension object.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the panel has a header component, the header is at index 0 and the first child component begins at index 1. Otherwise, the first child begins at index 0.
size The dimensions for the component.

See Also: getChildSize

setHeader

public void setHeader(IUIComponent header);

Sets the header component for the panel.

Return Value:

No return value.

ParameterDescription
header The component to be used as the panel's header component. For more information about headers, see the UIPanel overview.

See Also: getHeader

setID

public void setID(int id);

Sets the panel's identifier.

Return Value:

No return value.

ParameterDescription
id The value to be associated with the panel.

See Also: getID, setName

setLayout

public void setLayout(IUILayoutManager lm);

Sets the layout manager of the panel.

Return Value:

No return value.

ParameterDescription
lm The new layout manager of the panel.

Remarks:

This method invalidates the panel. When the panel is later validated, the new layout manager will compute the panel's size and lay out its components.

See Also: getLayout

setName

public void setName(String name);

Sets the panel's name.

Return Value:

No return value.

ParameterDescription
name The name to be associated with the panel.

See Also: getName, setID

setRedrawing

public void setRedrawing(boolean on);

Sets or clears the redrawing state of the panel. If the redrawing state is set, the panel will be redrawn when a paint request is made. If the redrawing state is cleared, the panel will not be redrawn.

Return Value:

No return value.

ParameterDescription
on If true, the redrawing state is set; otherwise, it is cleared.

Remarks:

If the on parameter is true, this method paints any invalid region.

Note To retrieve the current drawing state of the panel, call isRedrawing (inherited through UIStateContainer).

Overrides:

setRedrawing(boolean) in UIStateContainer.

See Also: paintAll

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