public class HorizontalSpinner
extends org.eclipse.swt.widgets.Composite
Constructor and Description |
---|
HorizontalSpinner(org.eclipse.swt.widgets.Composite parent,
int style)
Constructs a new instance of this class given its parent and a style
value describing its behavior and appearance.
|
Modifier and Type | Method and Description |
---|---|
void |
addModifyListener(org.eclipse.swt.events.ModifyListener listener)
Adds the listener to the collection of listeners who will be notified
when the receiver's text is modified, by sending it one of the messages
defined in the
ModifyListener interface. |
void |
addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds the listener to the collection of listeners who will be notified
when the control is selected by the user, by sending it one of the
messages defined in the
SelectionListener interface. |
void |
copy()
Copies the selected text.
|
void |
cut()
Cuts the selected text.
|
boolean |
forceFocus()
Forces the receiver to have the keyboard focus, causing all
keyboard events to be delivered to it.
|
int |
getDigits()
Returns the number of decimal places used by the receiver.
|
int |
getIncrement()
Returns the amount that the receiver's value will be modified by when the
up/down arrows are pressed.
|
int |
getMaximum()
Returns the maximum value which the receiver will allow.
|
int |
getMinimum()
Returns the minimum value which the receiver will allow.
|
int |
getPageIncrement()
Returns the amount that the receiver's position will be modified by when
the page up/down keys are pressed.
|
int |
getSelection()
Returns the selection, which is the receiver's position.
|
java.lang.String |
getText()
Returns a string containing a copy of the contents of the receiver's text
field, or an empty string if there are no contents.
|
int |
getTextLimit()
Returns the maximum number of characters that the receiver's text field
is capable of holding.
|
void |
paste()
Pastes text from clipboard.
|
void |
removeModifyListener(org.eclipse.swt.events.ModifyListener listener)
Removes the listener from the collection of listeners who will be
notified when the receiver's text is modified.
|
void |
removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners who will be
notified when the control is selected by the user.
|
void |
setBackground(org.eclipse.swt.graphics.Color color)
Sets the receiver's background color to the color specified by the
argument, or to the default system color for the control if the argument
is null.
|
void |
setBackgroundImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's background image to the image specified by the
argument, or to the default system color for the control if the argument
is null.
|
void |
setCursor(org.eclipse.swt.graphics.Cursor cursor)
Sets the receiver's cursor to the cursor specified by the argument, or to
the default cursor for that kind of control if the argument is null.
|
void |
setDigits(int value)
Sets the number of decimal places used by the receiver.
|
void |
setEnabled(boolean enabled)
Enables the receiver if the argument is
true , and disables
it otherwise. |
boolean |
setFocus()
Sets the receiver's drag detect state.
|
void |
setFont(org.eclipse.swt.graphics.Font font)
Sets the font that the receiver will use to paint textual information to
the font specified by the argument, or to the default font for that kind
of control if the argument is null.
|
void |
setForeground(org.eclipse.swt.graphics.Color color)
Sets the receiver's foreground color to the color specified by the
argument, or to the default system color for the control if the argument
is null.
|
void |
setIncrement(int value)
Sets the amount that the receiver's value will be modified by when the
up/down arrows are pressed to the argument, which must be at least one.
|
void |
setMaximum(int value)
Sets the maximum value that the receiver will allow.
|
void |
setMenu(org.eclipse.swt.widgets.Menu menu)
Sets the receiver's pop up menu to the argument.
|
void |
setMinimum(int value)
Sets the minimum value that the receiver will allow.
|
void |
setPageIncrement(int value)
Sets the amount that the receiver's position will be modified by when the
page up/down keys are pressed to the argument, which must be at least
one.
|
void |
setSelection(int selection)
Sets the selection, which is the receiver's position, to the
argument.
|
void |
setTextLimit(int limit)
Sets the maximum number of characters that the receiver's text field is
capable of holding to be the argument.
|
void |
setToolTipText(java.lang.String tooltipText)
Sets the receiver's tool tip text to the argument, which may be null
indicating that the default tool tip for the control will be shown.
|
void |
setValues(int selection,
int minimum,
int maximum,
int digits,
int increment,
int pageIncrement)
Sets the receiver's selection, minimum value, maximum value, digits,
increment and page increment all at once.
|
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBounds, setBounds, setCapture, setDragDetect, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public HorizontalSpinner(org.eclipse.swt.widgets.Composite parent, int style)
The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or must
be built by bitwise OR'ing together (that is, using the
int
"|" operator) two or more of those SWT
style constants. The class description lists the style constants that are
applicable to the class. Style bits are also inherited from superclasses.
parent
- a composite control which will be the parent of the new
instance (cannot be null)style
- the style of control to constructjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SWT.READ_ONLY
,
SWT.FLAT
public void addModifyListener(org.eclipse.swt.events.ModifyListener listener)
ModifyListener
interface.listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- ModifyListener
,
removeModifyListener(org.eclipse.swt.events.ModifyListener)
,
Spinner.addModifyListener(org.eclipse.swt.events.ModifyListener)
public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
SelectionListener
interface.
widgetSelected
is not called for texts.
widgetDefaultSelected
is typically called when ENTER is
pressed in a single-line text.
listener
- the listener which should be notified when the control is
selected by the userjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
public void copy()
The current selection is copied to the clipboard.
org.eclipse.swt.SWTException
- public void cut()
The current selection is first copied to the clipboard and then deleted from the widget.
org.eclipse.swt.SWTException
- public int getDigits()
org.eclipse.swt.SWTException
- public int getIncrement()
org.eclipse.swt.SWTException
- public int getMaximum()
org.eclipse.swt.SWTException
- public int getMinimum()
org.eclipse.swt.SWTException
- public int getPageIncrement()
org.eclipse.swt.SWTException
- public int getSelection()
org.eclipse.swt.SWTException
- public java.lang.String getText()
org.eclipse.swt.SWTException
- public int getTextLimit()
setTextLimit()
, it will be the constant
Spinner.LIMIT
.org.eclipse.swt.SWTException
- #LIMIT
public void paste()
The selected text is deleted from the widget and new text inserted from the clipboard.
org.eclipse.swt.SWTException
- public void removeModifyListener(org.eclipse.swt.events.ModifyListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- ModifyListener
,
addModifyListener(org.eclipse.swt.events.ModifyListener)
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public void setDigits(int value)
The digit setting is used to allow for floating point values in the receiver. For example, to set the selection to a floating point value of 1.37 call setDigits() with a value of 2 and setSelection() with a value of 137. Similarly, if getDigits() has a value of 2 and getSelection() returns 137 this should be interpreted as 1.37. This applies to all numeric APIs.
value
- the new digits (must be greater than or equal to zero)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setIncrement(int value)
value
- the new increment (must be greater than zero)org.eclipse.swt.SWTException
- public void setMaximum(int value)
value
- the new maximum, which must be greater than or equal to the
current minimumorg.eclipse.swt.SWTException
- public void setMinimum(int value)
value
- the new minimum, which must be less than or equal to the
current maximumorg.eclipse.swt.SWTException
- public void setPageIncrement(int value)
value
- the page increment (must be greater than zero)org.eclipse.swt.SWTException
- public void setSelection(int selection)
value
- the new selection (must be zero or greater)org.eclipse.swt.SWTException
- public void setTextLimit(int limit)
To reset this value to the default, use
setTextLimit(Spinner.LIMIT)
. Specifying a limit value larger
than Spinner.LIMIT
sets the receiver's limit to
Spinner.LIMIT
.
limit
- new text limitjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- #LIMIT
public void setValues(int selection, int minimum, int maximum, int digits, int increment, int pageIncrement)
Note: This is similar to setting the values individually using the appropriate methods, but may be implemented in a more efficient fashion on some platforms.
selection
- the new selection valueminimum
- the new minimum valuemaximum
- the new maximum valuedigits
- the new digits valueincrement
- the new increment valuepageIncrement
- the new pageIncrement valueorg.eclipse.swt.SWTException
- public boolean setFocus()
true
, the receiver will detect drag gestures, otherwise
these gestures will be ignored.setFocus
in class org.eclipse.swt.widgets.Composite
dragDetect
- the new drag detect stateorg.eclipse.swt.SWTException
- public boolean forceFocus()
forceFocus
in class org.eclipse.swt.widgets.Control
true
if the control got focus, and
false
if it was unable to.org.eclipse.swt.SWTException
- setFocus()
public void setBackground(org.eclipse.swt.graphics.Color color)
Note: This operation is a hint and may be overridden by the platform. For example, on Windows the background of a Button cannot be changed.
setBackground
in class org.eclipse.swt.widgets.Control
color
- the new color (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setBackgroundImage(org.eclipse.swt.graphics.Image image)
Note: This operation is a hint and may be overridden by the platform. For example, on Windows the background of a Button cannot be changed.
setBackgroundImage
in class org.eclipse.swt.widgets.Control
image
- the new image (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setCursor(org.eclipse.swt.graphics.Cursor cursor)
When the mouse pointer passes over a control its appearance is changed to match the control's cursor.
setCursor
in class org.eclipse.swt.widgets.Control
cursor
- the new cursor (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setEnabled(boolean enabled)
true
, and disables
it otherwise. A disabled control is typically not selectable from the
user interface and draws with an inactive or "grayed" look.setEnabled
in class org.eclipse.swt.widgets.Control
enabled
- the new enabled stateorg.eclipse.swt.SWTException
- public void setFont(org.eclipse.swt.graphics.Font font)
setFont
in class org.eclipse.swt.widgets.Control
font
- the new font (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setForeground(org.eclipse.swt.graphics.Color color)
Note: This operation is a hint and may be overridden by the platform.
setForeground
in class org.eclipse.swt.widgets.Control
color
- the new color (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setMenu(org.eclipse.swt.widgets.Menu menu)
Note: Disposing of a control that has a pop up menu will dispose of the menu. To avoid this behavior, set the menu to null before the control is disposed.
setMenu
in class org.eclipse.swt.widgets.Control
menu
- the new pop up menujava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setToolTipText(java.lang.String tooltipText)
The mnemonic indicator (character '&') is not displayed in a tool tip. To display a single '&' in the tool tip, the character '&' can be escaped by doubling it in the string.
setToolTipText
in class org.eclipse.swt.widgets.Control
string
- the new tool tip text (or null)org.eclipse.swt.SWTException
-