Packages
 In this topic

*Constructors

*Methods

 

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

 


Class AwtUIScrollBar

public class AwtUIScrollBar extends AwtUIControl implements 
            IAwtUIAdjustable
{
  // Constructors
  public AwtUIScrollBar();
  public AwtUIScrollBar(int style);
  public AwtUIScrollBar(int style, int min, int max, int page,
        int line, int pos);

  // Methods
  public void addAdjustmentListener(AdjustmentListener l);
  public IUIComponent getBase();
  public int getBlockIncrement();
  public Insets getInsets();
  public int getMaximum();
  public int getMinimum();
  public int getOrientation();
  public Point getPosition();
  public int getScrollLine();
  public int getScrollMax();
  public int getScrollMin();
  public int getScrollPage();
  public int getScrollPos();
  public int getStyle();
  public int getUnitIncrement();
  public int getValue();
  public int getVisibleAmount();
  protected void processAdjustmentEvent(AdjustmentEvent e);
  protected void processHostEvent(AWTEvent e);
  public synchronized void removeAdjustmentListener(
        AdjustmentListener l);
  public int scrollEnd();
  public int scrollHome();
  public int scrollLineDown();
  public int scrollLineUp();
  public int scrollPageDown();
  public int scrollPageUp();
  public void setBlockIncrement(int b);
  public void setMaximum(int max);
  public void setMinimum(int min);
  public void setPosition(Point pt);
  public void setPosition(int x, int y);
  public int setScrollInfo(int min, int max, int page, int line,
        int pos);
  public void setScrollLine(int line);
  public void setScrollMax(int max);
  public void setScrollMin(int min);
  public void setScrollPage(int page);
  public void setScrollPos(int pos);
  public int setScrollRange(int min, int max);
  public void setStyle(int style);
  public void setUnitIncrement(int u);
  public void setValue(int v);
  public void setVisibleAmount(int v);
}

This class implements the functionality of a UIScrollBar object in an AWT-based control. An AwtUIScrollBar control is an AwtUIHost component whose associated root container holds a UIScrollBar object. By hosting this object, an AwtUIScrollBar control integrates AFC with AWT. Although an AwtUIScrollBar control is fully compatible with AWT, a UIScrollBar control is optimized for performance and size.

Panel
  |
  +--AwtUIHost
    |
    +--AwtUIControl
      |
      +--AwtUIScrollBar

Constructors

AwtUIScrollBar

public AwtUIScrollBar();

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

AwtUIScrollBar

public AwtUIScrollBar(int style);

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

ParameterDescription
style The style of the control. You can pass any bitwise combination of the following values:

Exceptions:

IllegalArgumentException if an undefined style was specified.

AwtUIScrollBar

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

Creates an AWT-based scroll bar with the specified style and scroll information.

ParameterDescription
style The style of the control. You can pass any bitwise combination of the following values:
min The minimum scroll position in the control's range.
max The maximum scroll position in the control's range.
page The number of scroll positions that are associated with a page. The size of the THUMB component is based on the ratio of page to range.
line The number of scroll positions that are associated with a line.
pos The current scroll position.

Remarks:

For more information about range, page, and line values, see the UIScroll overview.

Exceptions:

IllegalArgumentException if an undefined style was specified.

Methods

addAdjustmentListener

public void addAdjustmentListener(AdjustmentListener l);

Adds the specified adjustment listener. The listener receives all adjustment events generated for the control.

Return Value:

No return value.

ParameterDescription
l The adjustment listener to be added.

See Also: removeAdjustmentListener

getBase

public IUIComponent getBase();

Retrieves the UI component that the control is based on.

Return Value:

Returns the UIScrollBar object associated with the control.

Remarks:

When the AWT-based control is first created, it is associated with a UIScrollBar object.

getBlockIncrement

public int getBlockIncrement();

Retrieves the block increment of the control. The block increment is defined as the number of scroll positions associated with a page.

Return Value:

Returns the number of scroll positions in a page.

Remarks:

This method implements getBlockIncrement in the IAwtUIAdjustable interface. For more information about page values, see the UIScroll overview.

See Also: getScrollPage, setScrollPage

getInsets

public Insets getInsets();

Retrieves the control's insets (in pixels), which identify the nonclient area of the control.

Return Value:

Returns an Insets object that contains the scroll bar's insets.

getMaximum

public int getMaximum();

Retrieves the maximum value in the control's range.

Return Value:

Returns the maximum scroll position.

Remarks:

This method implements getMaximum in the IAwtUIAdjustable interface.

See Also: getScrollMax, getMinimum, setMaximum

getMinimum

public int getMinimum();

Retrieves the minimum value in the control's range.

Return Value:

Returns the minimum scroll position.

Remarks:

This method implements getMinimum in the IAwtUIAdjustable interface.

See Also: getScrollMin, getMaximum, setMinimum

getOrientation

public int getOrientation();

Retrieves the orientation style of the control.

Return Value:

Returns an integer that contains the orientation style. Possible values include ScrollBar.VERTICAL or ScrollBar.HORIZONTAL.

Remarks:

This method implements getOrientation in the IAwtUIAdjustable interface.

getPosition

public Point getPosition();

Retrieves the position of the control.

Return Value:

Returns a Point object containing the current position.

Remarks:

If the scroll bar is horizontal, the x coordinate of the returned Point is the current scroll position, and the y coordinate is zero. If the scroll bar is vertical, the x coordinate is zero, and the y coordinate is the current scroll position.

See Also: setPosition

getScrollLine

public int getScrollLine();

Retrieves the number of scroll positions associated with a line.

Return Value:

Returns the number of scroll positions in a line.

Remarks:

For more information about line values, see the UIScroll overview.

See Also: getUnitIncrement, setScrollLine

getScrollMax

public int getScrollMax();

Retrieves the maximum value in the control's range.

Return Value:

Returns the maximum scroll position.

See Also: getMaximum, getScrollMin, setScrollMax

getScrollMin

public int getScrollMin();

Retrieves the minimum value in the control's range.

Return Value:

Returns the minimum scroll position.

See Also: getMinimum, getScrollMax, setScrollMin

getScrollPage

public int getScrollPage();

Retrieves the number of scroll positions associated with a page.

Return Value:

Returns the number of scroll positions in a page.

Remarks:

For more information about page values, see the UIScroll overview.

See Also: setScrollPage

getScrollPos

public int getScrollPos();

Retrieves the position of the control.

Return Value:

Returns the current scroll position.

See Also: getValue, getPosition, setScrollPos

getStyle

public int getStyle();

Retrieves the current style of the control.

Return Value:

Returns an integer containing the current style settings. For a list of possible styles, see setStyle.

getUnitIncrement

public int getUnitIncrement();

Retrieves the unit value increment of the control. This value is defined as the number of scroll positions associated with a line.

Return Value:

Returns the number of scroll positions in a line.

Remarks:

This method implements getUnitIncrement in the IAwtUIAdjustable interface. For more information about line values, see the UIScroll overview.

See Also: getScrollLine, setUnitIncrement

getValue

public int getValue();

Retrieves the control's value, which is defined as its current position.

Return Value:

Returns the current scroll position.

Remarks:

This method implements getValue in the IAwtUIAdjustable interface.

See Also: getScrollPos, setValue

getVisibleAmount

public int getVisibleAmount();

Retrieves the length of the control's THUMB component. This value is based on the number of scroll positions associated with a page.

Return Value:

Returns the number of scroll positions in a page.

Remarks:

This method implements getVisibleAmount in the IAwtUIAdjustable interface. For more information about page values, see the UIScroll overview.

See Also: getScrollPage, setVisibleAmount

processAdjustmentEvent

protected void processAdjustmentEvent(AdjustmentEvent e);

Processes adjustment events.

Return Value:

No return value.

ParameterDescription
e The adjustment event.

Remarks:

This method is called by processHostEvent and dispatches the event to a registered adjustment listener. When overriding this method, call the super method processAdjustmentEvent to ensure the default event processing continues normally.

See Also: addAdjustmentListener

processHostEvent

protected void processHostEvent(AWTEvent e);

Processes the specified event.

Return Value:

No return value.

ParameterDescription
e The event.

Remarks:

This method is automatically invoked if a listener has has been registered through a call to addXXXListener. Depending on the type of event, processHostEvent calls one of the following methods.

Event type Method called
adjustment event processAdjustmentEvent
component event processComponentEvent (inherited through AwtUIHost)
container event processContainerEvent (inherited through AwtUIHost)
focus event processFocusEvent (inherited through AwtUIHost)
key event processKeyEvent (inherited through AwtUIHost)
mouse event processMouseEvent (inherited through AwtUIHost)
mouse motion event processMouseMotionEvent (inherited through AwtUIHost)

When overriding processHostEvent, call the super method processHostEvent to ensure the default event processing continues normally.

removeAdjustmentListener

public synchronized void removeAdjustmentListener(AdjustmentListener l);

Removes the specified adjustment listener. The listener no longer receives the control's adjustment events.

Return Value:

No return value.

ParameterDescription
l The adjustment listener to be removed.

See Also: addAdjustmentListener

scrollEnd

public int scrollEnd();

Moves the current scroll position to the maximum range value.

Return Value:

Returns the control's new scroll position.

See Also: scrollHome

scrollHome

public int scrollHome();

Moves the current scroll position to the minimum range value.

Return Value:

Returns the control's new scroll position.

See Also: scrollEnd

scrollLineDown

public int scrollLineDown();

Increments the current scroll position by one line.

Return Value:

Returns the control's new scroll position.

Remarks:

For more information about line values, see the UIScroll overview.

See Also: scrollLineUp

scrollLineUp

public int scrollLineUp();

Decrements the current scroll position by one line.

Return Value:

Returns the control's new scroll position.

Remarks:

For more information about line values, see the UIScroll overview.

See Also: scrollLineDown

scrollPageDown

public int scrollPageDown();

Increments the current scroll position by one line less than a full page.

Return Value:

Returns the control's new scroll position.

Remarks:

If the difference between the page and line values is negative or zero, the scroll position is incremented by one scroll position. For more information about page and line values, see the UIScroll overview.

See Also: scrollPageUp

scrollPageUp

public int scrollPageUp();

Decrements the current scroll position by one line less than a full page.

Return Value:

Returns the control's new scroll position.

Remarks:

If the difference between the page and line values is negative or zero, the scroll position is decremented by one scroll position. For more information about page and line values, see the UIScroll overview.

See Also: scrollPageDown

setBlockIncrement

public void setBlockIncrement(int b);

Sets the block increment for the control. The block increment is defined as the number of scroll positions associated with a page.

Return Value:

No return value.

ParameterDescription
b The number of scroll positions to be associated with a page.

Remarks:

This method implements setBlockIncrement in the IAwtUIAdjustable interface. For more information about page values, see the UIScroll overview.

See Also: setScrollPage, getBlockIncrement

setMaximum

public void setMaximum(int max);

Sets the maximum range value and adjusts the control's current position accordingly.

Return Value:

No return value.

ParameterDescription
max The maximum scroll position.

Remarks:

This method implements setMaximum in the IAwtUIAdjustable interface.

See Also: setScrollMax, setMinimum, getMaximum

setMinimum

public void setMinimum(int min);

Sets the minimum range value and adjusts the control's current position accordingly.

Return Value:

No return value.

ParameterDescription
min The minimum scroll position.

Remarks:

This method implements setMinimum in the IAwtUIAdjustable interface.

See Also: setScrollMin, setMaximum, getMinimum

setPosition

public void setPosition(Point pt);

Sets the position of the control, based on the specified Point.

Return Value:

No return value.

ParameterDescription
pt The requested position for the control. The x and y coordinates of pt specify the horizontal and vertical scroll positions (in pixels), respectively.

Remarks:

If the scroll bar is horizontal, the x coordinate of the returned Point is the new scroll position, and the y coordinate is zero. If the scroll bar is vertical, the x coordinate is zero, and the y coordinate is the new scroll position. Depending on the control's range, these coordinates may differ from those of the parameter pt.

See Also: getPosition

setPosition

public void setPosition(int x, int y);

Sets the position of the control, based on the specified values.

Return Value:

No return value.

ParameterDescription
x The requested horizontal scroll position (in pixels).
y The requested vertical scroll position (in pixels).

Remarks:

If the scroll bar is horizontal, the x coordinate of the returned Point is the new scroll position, and the y coordinate is zero. If the scroll bar is vertical, the x coordinate is zero, and the y coordinate is the scroll position. Depending on the control's range, these coordinates may differ from the x and y parameters.

See Also: getPosition

setScrollInfo

public int setScrollInfo(int min, int max, int page, int line, int pos);

Sets the specified scroll information and adjusts the control's current position accordingly.

Return Value:

Returns the control's new scroll position after setting the specified values.

ParameterDescription
min The minimum scroll position in the control's range.
max The maximum scroll position in the control's range.
page The number of scroll positions associated with a page.
line The number of scroll positions associated with a line.
pos The current scroll position.

Remarks:

If the NONPROPORTIONAL style is not set and the page value is nonzero, the size of the THUMB component represents the ratio of page to range. Otherwise, the size of THUMB represents a scroll position. For more information about range, page, and line values, see the UIScroll overview.

setScrollLine

public void setScrollLine(int line);

Sets the number of scroll positions associated with a line and adjusts the control's current position accordingly.

Return Value:

No return value.

ParameterDescription
line The number of scroll positions to be associated with a line.

Remarks:

For more information about line values, see the UIScroll overview.

See Also: setUnitIncrement, getScrollLine

setScrollMax

public void setScrollMax(int max);

Sets the maximum range value and adjusts the control's current position accordingly.

Return Value:

No return value.

ParameterDescription
max The maximum scroll position.

See Also: setMaximum, setScrollMin, getScrollMax

setScrollMin

public void setScrollMin(int min);

Sets the minimum range value and adjusts the control's current position accordingly.

Return Value:

No return value.

ParameterDescription
min The minimum scroll position.

See Also: setMinimum, setScrollMax, getScrollMin

setScrollPage

public void setScrollPage(int page);

Sets the number of scroll positions associated with a page and adjusts the control's current position accordingly.

Return Value:

No return value.

ParameterDescription
page The number of scroll positions to be associated with a page.

Remarks:

If the NONPROPORTIONAL style is not set and the page value is nonzero, the size of the THUMB component represents the ratio of page to range. Otherwise, the size of THUMB represents a scroll position. For more information about page values, see the UIScroll overview.

See Also: setBlockIncrement, getScrollPage

setScrollPos

public void setScrollPos(int pos);

Sets the control's current position to the specified scroll position.

Return Value:

No return value.

ParameterDescription
pos The scroll position of the control.

Remarks:

Depending on the control's range, the returned position may differ from the pos parameter.

See Also: setValue, setPosition, getScrollPos

setScrollRange

public int setScrollRange(int min, int max);

Sets the control's range and adjusts the control's current position accordingly.

Return Value:

Returns the control's new scroll position after setting the specified values.

ParameterDescription
min The minimum scroll position.
max The maximum scroll position.

setStyle

public void setStyle(int style);

Sets the current style for the control.

Return Value:

No return value.

ParameterDescription
style The style of the control. You can pass any bitwise combination of the following values:

Exceptions:

IllegalArgumentException if an undefined style was specified.

setUnitIncrement

public void setUnitIncrement(int u);

Sets the unit value increment of the control. This value is defined as the number of scroll positions associated with a line.

Return Value:

No return value.

ParameterDescription
u The number of scroll positions to be associated with a line.

Remarks:

This method implements setUnitIncrement in the IAwtUIAdjustable interface. For more information about line values, see the UIScroll overview.

See Also: setScrollLine, getUnitIncrement

setValue

public void setValue(int v);

Sets the control's value, which is defined as its current position.

Return Value:

No return value.

ParameterDescription
v The position for the control.

Remarks:

This method implements setValue in the IAwtUIAdjustable interface.

See Also: setScrollPos, getValue

setVisibleAmount

public void setVisibleAmount(int v);

Sets the length of the control's THUMB component. This value is used as the number of scroll positions associated with a page.

Return Value:

No return value.

ParameterDescription
v The number of scroll positions to be associated with a page.

Remarks:

This method implements setVisibleAmount in the IAwtUIAdjustable interface. For more information about page values, see the UIScroll overview.

See Also: setScrollPage, getVisibleAmount

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