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

Class UIScrollBar

Constructors , Methods , Fields

public class UIScrollBar extends UIScroll
{
  // Fields
  public static final int LINE_UP;
  public static final int LINE_DOWN;

  // Constructors
  public UIScrollBar();
  public UIScrollBar(int style);
  public UIScrollBar(int style, int min, int max, int page, int line, 
                     int pos);

  // Methods
  public Component add(int index, Component comp);
  public Component getLayoutComponent(int index);
  public void initGraphics();
  public void setStyle(int style);

  public Insets insets();
  public void layout();
  public Dimension minimumSize();
  public Dimension preferredSize();

}

A class that implements a scroll bar control. UIScrollBar extends UIScroll by adding the LINE_UP and LINE_DOWN components to the ends of the scroll track. By default, these components are UIRepeatButton objects.


Constructors


UIScrollBar

public UIScrollBar();

Creates a horizontal scroll bar control. By default, the scroll bar has a range of 0 to 100.


UIScrollBar

public UIScrollBar(int style);

Creates a scroll bar control with the specified style. By default, the scroll bar has a range of 0 to 100.

ParameterDescription
style The style of the scroll bar. Specify one of the following values:

If an undefined style is specified, an IllegalArgumentException is thrown.


UIScrollBar

public UIScrollBar(int style, int min, int max, int page, 
                   int line, int pos);

Creates a scroll bar control with the specified style and scroll information.

ParameterDescription
style The style of the scroll bar. Specify one of the following values:

If an undefined style is specified, an IllegalArgumentException is thrown.

min The minimum value in the scroll bar's range.
max The maximum value in the scroll bar's range.
page The number of scroll positions associated with a full page.
line The number of pixels associated with a scroll position.
pos The current position of the scroll bar control within its range.


Methods


add

public Component add(int index, Component comp);

Adds the specified component at the given layout index. If a component already exists at this index, it is replaced with the specified component.

Return Value:

Returns the component that was added.

ParameterDescription
index The layout index of the component to be added or replaced. Specify one of the following values:

If an undefined index is specified, an IllegalArgumentException is thrown.

comp The component to be added.


getLayoutComponent

public Component getLayoutComponent(int index);

Retrieves the component at the specified layout index.

Return Value:

Returns the specified component, or null if no such component exists.

ParameterDescription
index The layout index of the component to be retrieved. Specify one of the following values:

If an undefined layout index is specified, an IllegalArgumentException is thrown.


initGraphics

public void initGraphics();

Called to perform initialization when the graphics context is first available.

Return Value:

No return value.

Remarks:

This method adds the THUMB, PAGE_UP, PAGE_DOWN, LINE_UP, and LINE_DOWN components to the scroll bar. If the scroll bar is horizontal, the LINE_UP and LINE_DOWN components display the system-defined left and right arrows, respectively. If the scroll bar is vertical, the components displays the system-defined up and down arrows.


insets

public Insets insets();

Determines the scroll bar's insets (in pixels), which indicate the size of the control's border.

Return Value:

Returns an Insets object containing the scroll bar's insets.


layout

public void layout();

Lays out the components of the scroll bar control.

Return Value:

No return value.

Remarks:

If the scroll bar has the NOHIDE style, it will be disabled if scrolling is not necessary. Otherwise, if the NOSHOW style is set, or if scrolling is not necessary, the control will be hidden.


minimumSize

public Dimension minimumSize();

Determines the minimum size (in pixels) of the scroll bar control.

Return Value:

Returns a Dimension object containing the minimum size.

Remarks:

The control's minimum size is based on the minimum of each of its components.


preferredSize

public Dimension preferredSize();

Determines the preferred size (in pixels) of the scroll bar control.

Return Value:

Returns a Dimension object containing the preferred size.

Remarks:

The control's preferred size is based on the preferred size of each of its components.


setStyle

public void setStyle(int style);

Sets the current style for the scroll bar control.

Return Value:

No return value.

ParameterDescription
style The style of the scroll bar. Specify one of the following values:

If an undefined style is specified, an IllegalArgumentException is thrown.


Fields

LINE_UP
The layout index for the component that moves the control's position back one scroll position.
LINE_DOWN
The layout index for the component that moves the control's position forward one scroll position.


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