Class UISpinner
public class UISpinner extends UIScroll
{
// Fields
public static final int BUDDY;
public static final int CIRCULAR;
public static final int LINE_DOWN;
public static final int LINE_UP;
public static final int RAISED;
// Constructors
public UISpinner();
public UISpinner(int style);
public UISpinner(int style, int min, int max, int page, int line,
int pos);
// Methods
public IUIComponent add(int index, IUIComponent comp);
public IUIComponent getLayoutComponent(int index);
public Dimension getMinimumSize();
public Dimension getPreferredSize();
public int getRoleCode();
public int getScrollPos();
public void layout();
public int scrollLineDown();
public int scrollLineUp();
public int scrollPageDown();
public int scrollPageUp();
public int setScrollInfo(int min, int max, int page, int line,
int pos);
public void setStyle(int style);
}
This class implements a spinner control and its buttons. UISpinner is closely related to the UISpinnerEdit class.
UISpinner controls have no associated text control, so they can be used with any other type of control.
UIComponent
|
+--UIContainer
|
+--UIStateContainer
|
+--UIPanel
|
+--UIScroll
|
+--UISpinner
public UISpinner();
Creates a horizontal spinner control with a range of 0-100. By default, the style of the spinner control is RAISED.
public UISpinner(int style);
Creates a spinner control with a range of 0-100 and with the specified button style.
Parameter | Description |
style
| The style of spinner. This can be one or a combination of RAISED, VERTICAL, or CIRCULAR.
|
public UISpinner(int style, int min, int max, int page, int line, int pos);
Creates a spinner control with the given metrics and with the specified style.
Parameter | Description |
style
| The style of spinner. This can be one or a combination of RAISED, VERTICAL, or CIRCULAR.
|
min
| The minimum value of the spinner's range.
|
max
| The maximum value of the spinner's range.
|
page
| The number of scroll positions associated with a full page up or page down event.
|
line
| The number to add or subtract when a line up or line down event is processed.
|
pos
| The starting position inside the spinner's range.
|
public IUIComponent add(int index, IUIComponent comp);
Adds or replaces the specified spinner component with the given component.
Return Value:
Returns the component that was replaced by the added component.
Parameter | Description |
index
| The layout index of component to replace. This can be one of the following indices.
|
comp
| The new component to use in the spinner.
|
Remarks:
This method adds a UI component to the spinner, typically a UIEdit, UIText or similar object commonly associated with spinner controls (although any component can be added).
Overrides:
add(int,IUIComponent) in UIScroll.
public IUIComponent getLayoutComponent(int index);
Retrieves the layout component at the specified index.
Return Value:
Returns the component at that layout index, or null if there is none.
Parameter | Description |
index
| The layout index of component to retrieve. This can be one of the following indices:
- LINE_UP
- LINE_DOWN
- BUDDY
|
Overrides:
getLayoutComponent(int) in UIScroll.
public Dimension getMinimumSize();
Retrieves the preferred layout size for the spinner control's two buttons (in pixels).
Return Value:
Returns a Dimension that represents the minimum layout size needed for the two buttons.
Remarks:
This method is not called directly by the application. It is used in the layout method and other private methods to lay out the spinner control.
Overrides:
getMinimumSize() in UIScroll.
public Dimension getPreferredSize();
Retrieves the preferred layout size for the spinner control's two buttons (in pixels).
Return Value:
Returns a Dimension that represents the preferred layout size needed for the two buttons.
Remarks:
This method is not called directly by the application. It is used in the layout method and other private methods to lay out the spinner control.
Overrides:
getPreferredSize() in UIScroll.
public int getRoleCode();
Retrieves the Microsoft® Active Accessibility role code of the current object.
Return Value:
Returns the ROLE_SYSTEM_SCROLLBAR role code.
Overrides:
getRoleCode() in UIScroll.
public int getScrollPos();
Retrieves the position of the spinner.
Return Value:
Returns the current scroll position.
Overrides:
getScrollPos() in UIScroll.
public void layout();
Lays out the spinner control's buttons.
Return Value:
No return value.
Overrides:
layout() in UIScroll.
public int scrollLineDown();
Decrements the spinner position by one selection.
Return Value:
Returns the new spinner position after setting the value.
Overrides:
scrollLineDown() in UIScroll.
public int scrollLineUp();
Increments the spinner position one selection.
Return Value:
Returns the new spinner position after setting the value.
Overrides:
scrollLineUp() in UIScroll.
public int scrollPageDown();
Decrements the spinner position by one page.
Return Value:
Returns the new spinner position after setting the value.
Remarks:
If you use a constructor where page is not a user- specified parameter, page is set to zero by default.
Overrides:
scrollPageDown() in UIScroll.
public int scrollPageUp();
Increments the spinner position by one page.
Return Value:
Returns the new spinner position after setting the value.
Remarks:
If you use a constructor where page is not a user- specified parameter, page is set to zero by default.
Overrides:
scrollPageUp() in UIScroll.
public int setScrollInfo(int min, int max, int page, int line, int pos);
Sets the specified scroll information in the spinner 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 value of the spinner's range.
|
max
| The maximum value of the spinner's range.
|
page
| The number of scroll positions associated with a full page up or page down event.
|
line
| The number to add or subtract when a line up or line down event is processed.
|
pos
| The starting position inside the spinner's range.
|
Overrides:
setScrollInfo(int,int,int,int,int) in UIScroll.
public void setStyle(int style);
Set the current style for this spinner.
Return Value:
No return value.
Parameter | Description |
style
| The style of spinner. This can be one or a combination of RAISED, VERTICAL, or CIRCULAR.
|
Overrides:
setStyle(int) in UIScroll.
Exceptions:
IllegalArgumentException
if any undefined style bits are specified.
- BUDDY
- The control associated with the spinner that is laid out to the left of the spinner (UISpinnerEdit uses an edit control).
- CIRCULAR
- The spinner cycles through its range of values in a closed loop.
- LINE_DOWN
- The layout index for the down arrow on the spinner control.
- LINE_UP
- The layout index for the up arrow on the spinner control.
- RAISED
- A raised button style for the spinner control's buttons.