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
public AwtUIScrollBar();
Creates an AWT-based horizontal scroll bar. By default, the control has a range of 0 to 100.
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.
Parameter | Description |
style
| The style of the control. You can pass any bitwise combination of the following values:
|
Exceptions:
IllegalArgumentException
if an undefined style was specified.
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.
Parameter | Description |
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.
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.
Parameter | Description |
l
| The adjustment listener to be added.
|
See Also: removeAdjustmentListener
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.
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
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.
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
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
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.
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
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
public int getScrollMax();
Retrieves the maximum value in the control's range.
Return Value:
Returns the maximum scroll position.
See Also: getMaximum, getScrollMin, setScrollMax
public int getScrollMin();
Retrieves the minimum value in the control's range.
Return Value:
Returns the minimum scroll position.
See Also: getMinimum, getScrollMax, setScrollMin
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
public int getScrollPos();
Retrieves the position of the control.
Return Value:
Returns the current scroll position.
See Also: getValue, getPosition, setScrollPos
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.
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
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
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
protected void processAdjustmentEvent(AdjustmentEvent e);
Processes adjustment events.
Return Value:
No return value.
Parameter | Description |
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
protected void processHostEvent(AWTEvent e);
Processes the specified event.
Return Value:
No return value.
Parameter | Description |
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.
When overriding processHostEvent, call the super method processHostEvent to ensure the default event processing continues normally.
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.
Parameter | Description |
l
| The adjustment listener to be removed.
|
See Also: addAdjustmentListener
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
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
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
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
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
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
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.
Parameter | Description |
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
public void setMaximum(int max);
Sets the maximum range value and adjusts the control's current position accordingly.
Return Value:
No return value.
Parameter | Description |
max
| The maximum scroll position.
|
Remarks:
This method implements setMaximum in the IAwtUIAdjustable interface.
See Also: setScrollMax, setMinimum, getMaximum
public void setMinimum(int min);
Sets the minimum range value and adjusts the control's current position accordingly.
Return Value:
No return value.
Parameter | Description |
min
| The minimum scroll position.
|
Remarks:
This method implements setMinimum in the IAwtUIAdjustable interface.
See Also: setScrollMin, setMaximum, getMinimum
public void setPosition(Point pt);
Sets the position of the control, based on the specified Point.
Return Value:
No return value.
Parameter | Description |
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
public void setPosition(int x, int y);
Sets the position of the control, based on the specified values.
Return Value:
No return value.
Parameter | Description |
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
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.
Parameter | Description |
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.
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.
Parameter | Description |
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
public void setScrollMax(int max);
Sets the maximum range value and adjusts the control's current position accordingly.
Return Value:
No return value.
Parameter | Description |
max
| The maximum scroll position.
|
See Also: setMaximum, setScrollMin, getScrollMax
public void setScrollMin(int min);
Sets the minimum range value and adjusts the control's current position accordingly.
Return Value:
No return value.
Parameter | Description |
min
| The minimum scroll position.
|
See Also: setMinimum, setScrollMax, getScrollMin
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.
Parameter | Description |
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
public void setScrollPos(int pos);
Sets the control's current position to the specified scroll position.
Return Value:
No return value.
Parameter | Description |
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
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.
Parameter | Description |
min
| The minimum scroll position.
|
max
| The maximum scroll position.
|
public void setStyle(int style);
Sets the current style for the control.
Return Value:
No return value.
Parameter | Description |
style
| The style of the control. You can pass any bitwise combination of the following values:
|
Exceptions:
IllegalArgumentException
if an undefined style was specified.
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.
Parameter | Description |
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
public void setValue(int v);
Sets the control's value, which is defined as its current position.
Return Value:
No return value.
Parameter | Description |
v
| The position for the control.
|
Remarks:
This method implements setValue in the IAwtUIAdjustable interface.
See Also: setScrollPos, getValue
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.
Parameter | Description |
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