Package com.ms.ui Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class UISplitViewer

Constructors , Methods , Fields

public class UISplitViewer extends UIPanel
{
  // Fields
  public final static int HORIZONTAL;

  // Constructors
  public UISplitViewer(Component nw, Component se);
  public UISplitViewer(Component nw, Component se, int style);
  public UISplitViewer(Component nw, Component se, int style, int size);
  public UISplitViewer(Component nw, Component se, int style, int size, 
                       boolean addScroll);

  // Methods
  public Component getComponent(String name);
  public int getPos();
  public int getStyle();
  public void setPos(int pos);

  public boolean mouseDown(Event e, int x, int y);
  public boolean mouseUp(Event e, int x, int y);
  public boolean mouseDrag(Event e, int x, int y);

}

A class that implements a split viewer control. UISplitViewer uses UISplitLayout to manage three components, identified as follows.

Layout Component Description
NW Identifies the component in the North pane if the split is horizontal or the West pane if the split is vertical.
SE Identifies the component in the South pane if the split is horizontal or the East pane if the split is vertical.
Splitter The splitter component positioned between the NW and SE panes. By default, UISplitViewer uses UIThumb to implement the splitter component.

When you create a UISplitViewer object, you can specify whether the split will be horizontal or veritcal (the default). You can additionally set the size of the NW component by specifying its height (if the split is horizontal) or its width (if the split is vertical). A negative size means the height or width is a percentage of the split viewer's total height or width. A positive size specifies the height or width as an absolute value in pixels. The remainder of the split viewer is filled with the splitter component and the SE component. You can also specify that scroll bars be added to each pane when necessary. The following example shows different ways to construct UISplitViewer objects.

UISplitViewer sv1, sv2;
UIList myList= new UIList();
... // Add items to myList.
UIGraphic myGraphic = new UIGraphic(...);

// Construct a horizontal split viewer where the height of 
// the North component is 40% of the viewer's total height.
// By default, no scroll bars will be added to the North
// and South components.
sv1 = new UISplitViewer(myList, myGraphic, UISplitViewer.HORIZONTAL, -40);

// Construct a vertical split viewer where the width of 
// the West component is 150 pixels. Allow scroll bars to
// be added to each pane when necessary.
sv2 = new UISplitViewer(myList, myGraphic, 0, 150, true);


Constructors


UISplitViewer

public UISplitViewer(Component nw, Component se);

Creates a vertical split viewer control with the specified components.

ParameterDescription
nw The content component for the West pane of the split viewer.
se The content component for the East pane of the split viewer.

Remarks:

By default, the size of the nw component is -50. For more information about sizes, see the UISplitViewer overview.


UISplitViewer

public UISplitViewer(Component nw, Component se, int style);

Creates a split viewer control with the specified components and the specified style.

ParameterDescription
nw The content component for the North or West pane of the split viewer.
se The content component for the South or East pane of the split viewer.
style The style of the viewer. Specify HORIZONTAL for a horizontal split, or 0 for a vertical split.

Remarks:

By default, the size of the nw component is -50. For more information about sizes, see the UISplitViewer overview.


UISplitViewer

public UISplitViewer(Component nw, Component se, int style, int size);

Creates a split viewer control with the specified components, style, and size.

ParameterDescription
nw The content component for the North or West pane of the split viewer.
se The content component for the South or East pane of the split viewer.
style The style of the viewer. Specify HORIZONTAL for a horizontal split, or 0 for a vertical split.
size The size of the nw component. A negative value means the height or width is a percentage of the split viewer's total height or width. A positive value specifies the absolute height or width in pixels. For more information, see the UISplitViewer overview.

Remarks:

If the size parameter is less than -100, an IllegalArgumentException is thrown.


UISplitViewer

public UISplitViewer(Component nw, Component se, int style, 
                     int size, boolean addScroll);

Creates a split viewer control with the specified components, style, and size, and optional scroll bar support.

ParameterDescription
nw The content component for the North or West pane of the split viewer.
se The content component for the South or East pane of the split viewer.
style The style of the viewer. Specify HORIZONTAL for a horizontal split, or 0 for a vertical split.
size The size of the nw component. A negative value means the height or width is a percentage of the split viewer's total height or width. A positive value specifies the absolute height or width in pixels. For more information, see the UISplitViewer overview.
addScroll If true, scroll bars will be added to each pane when they are needed; otherwise, neither pane will provide scroll bars.

Remarks:

If the size parameter is less than -100, an IllegalArgumentException is thrown.


Methods


getStyle

public int getStyle();

Retrieves the style of the split viewer.

Return Value:

Returns an integer containing the current style bits.


getPos

public int getPos();

Retrieves the current split position.

Return Value:

Returns the split position used by the split layout manager.

Remarks:

This method retrieves the viewer's split position, which is based on the size of the NW component. For more information about split positions, see the UISplitLayout overview.


getComponent

public Component getComponent(String name);

Retrieves the component identified by name.

Return Value:

Returns the specified component.

ParameterDescription
name The layout name that identifies the component to be retrieved. Specify "NW" for the component in the North or West pane, "SE" for the component in the South or East pane, or "Splitter" for the splitter control between the panes.

Remarks:

Note that the name parameter is not case-sensitive. If an undefined name is specified, an IllegalArgumentException is thrown.


mouseDown

public boolean mouseDown(Event e, int x, int y);

Responds to the mouse button being pressed over the splitter component.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
event The event posted to the split viewer control.
x The x coordinate of the event.
y The y coordinate of the event.


mouseDrag

public boolean mouseDrag(Event e, int x, int y);

Responds to the splitter component being dragged with the mouse, and moves the splitter accordingly.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
event The event posted to the split viewer control.
x The x coordinate of the event.
y The y coordinate of the event.


mouseUp

public boolean mouseUp(Event e, int x, int y);

Responds to the mouse button being released over the splitter component.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
event The event posted to the split viewer control.
x The x coordinate of the event.
y The y coordinate of the event.


setPos

public void setPos(int pos);

Sets the current split position.

Return Value:

No return value.

ParameterDescription
pos The split position to be used by the split layout manager.

Remarks:

This method sets the viewer's split position, which is based on the size of the NW component. For more information about split positions, see the UISplitLayout overview.


Fields

HORIZONTAL
Specifies that the split viewer control will be laid out with a horizontal split, which identifies North and South panes. The default style is a vertical split with West and East panes.


Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.