Class HorizontalSpinner

java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.nebula.widgets.opal.horizontalspinner.HorizontalSpinner
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class HorizontalSpinner
extends org.eclipse.swt.widgets.Composite
Instances of this class are selectable user interface objects that allow the user to enter and modify numeric values.

Styles:
READ_ONLY, FLAT
Events:
Selection, Modify

  • Field Summary

    Fields inherited from class org.eclipse.swt.widgets.Control

    handle
  • Constructor Summary

    Constructors 
    Constructor 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.
  • Method Summary

    Modifier and Type Method 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.

    Methods inherited from class org.eclipse.swt.widgets.Composite

    changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList, toString

    Methods inherited from class org.eclipse.swt.widgets.Scrollable

    computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar

    Methods inherited from class org.eclipse.swt.widgets.Control

    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

    Methods inherited from class org.eclipse.swt.widgets.Widget

    addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.swt.graphics.Drawable

    isAutoScalable
  • Constructor Details

    • HorizontalSpinner

      public 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.

      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.

      Parameters:
      parent - a composite control which will be the parent of the new instance (cannot be null)
      style - the style of control to construct
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the parent is null
      org.eclipse.swt.SWTException -
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
      • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
      See Also:
      SWT.READ_ONLY, SWT.FLAT
  • Method Details

    • addModifyListener

      public 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.
      Parameters:
      listener - the listener which should be notified
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the listener is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      ModifyListener, removeModifyListener(org.eclipse.swt.events.ModifyListener), Spinner.addModifyListener(org.eclipse.swt.events.ModifyListener)
    • addSelectionListener

      public 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.

      widgetSelected is not called for texts. widgetDefaultSelected is typically called when ENTER is pressed in a single-line text.

      Parameters:
      listener - the listener which should be notified when the control is selected by the user
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the listener is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      SelectionListener, removeSelectionListener(org.eclipse.swt.events.SelectionListener), SelectionEvent
    • copy

      public void copy()
      Copies the selected text.

      The current selection is copied to the clipboard.

      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • cut

      public void cut()
      Cuts the selected text.

      The current selection is first copied to the clipboard and then deleted from the widget.

      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getDigits

      public int getDigits()
      Returns the number of decimal places used by the receiver.
      Returns:
      the digits
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getIncrement

      public int getIncrement()
      Returns the amount that the receiver's value will be modified by when the up/down arrows are pressed.
      Returns:
      the increment
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getMaximum

      public int getMaximum()
      Returns the maximum value which the receiver will allow.
      Returns:
      the maximum
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getMinimum

      public int getMinimum()
      Returns the minimum value which the receiver will allow.
      Returns:
      the minimum
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getPageIncrement

      public int getPageIncrement()
      Returns the amount that the receiver's position will be modified by when the page up/down keys are pressed.
      Returns:
      the page increment
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getSelection

      public int getSelection()
      Returns the selection, which is the receiver's position.
      Returns:
      the selection
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getText

      public 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.
      Returns:
      the receiver's text
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getTextLimit

      public int getTextLimit()
      Returns the maximum number of characters that the receiver's text field is capable of holding. If this has not been changed by setTextLimit(), it will be the constant Spinner.LIMIT.
      Returns:
      the text limit
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      #LIMIT
    • paste

      public void paste()
      Pastes text from clipboard.

      The selected text is deleted from the widget and new text inserted from the clipboard.

      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • removeModifyListener

      public 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.
      Parameters:
      listener - the listener which should no longer be notified
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the listener is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      ModifyListener, addModifyListener(org.eclipse.swt.events.ModifyListener)
    • removeSelectionListener

      public 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.
      Parameters:
      listener - the listener which should no longer be notified
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the listener is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      SelectionListener, addSelectionListener(org.eclipse.swt.events.SelectionListener)
    • setDigits

      public void setDigits​(int value)
      Sets the number of decimal places used by the receiver.

      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.

      Parameters:
      value - the new digits (must be greater than or equal to zero)
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the value is less than zero
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setIncrement

      public 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.
      Parameters:
      value - the new increment (must be greater than zero)
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setMaximum

      public void setMaximum​(int value)
      Sets the maximum value that the receiver will allow. This new value will be ignored if it is less than the receiver's current minimum value. If the new maximum is applied then the receiver's selection value will be adjusted if necessary to fall within its new range.
      Parameters:
      value - the new maximum, which must be greater than or equal to the current minimum
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setMinimum

      public void setMinimum​(int value)
      Sets the minimum value that the receiver will allow. This new value will be ignored if it is greater than the receiver's current maximum value. If the new minimum is applied then the receiver's selection value will be adjusted if necessary to fall within its new range.
      Parameters:
      value - the new minimum, which must be less than or equal to the current maximum
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setPageIncrement

      public 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.
      Parameters:
      value - the page increment (must be greater than zero)
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setSelection

      public void setSelection​(int selection)
      Sets the selection, which is the receiver's position, to the argument. If the argument is not within the range specified by minimum and maximum, it will be adjusted to fall within this range.
      Parameters:
      value - the new selection (must be zero or greater)
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setTextLimit

      public void setTextLimit​(int limit)
      Sets the maximum number of characters that the receiver's text field is capable of holding to be the argument.

      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.

      Parameters:
      limit - new text limit
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_CANNOT_BE_ZERO - if the limit is zero
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      #LIMIT
    • setValues

      public 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.

      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.

      Parameters:
      selection - the new selection value
      minimum - the new minimum value
      maximum - the new maximum value
      digits - the new digits value
      increment - the new increment value
      pageIncrement - the new pageIncrement value
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setFocus

      public boolean setFocus()
      Sets the receiver's drag detect state. If the argument is true, the receiver will detect drag gestures, otherwise these gestures will be ignored.
      Overrides:
      setFocus in class org.eclipse.swt.widgets.Composite
      Parameters:
      dragDetect - the new drag detect state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • forceFocus

      public boolean forceFocus()
      Forces the receiver to have the keyboard focus, causing all keyboard events to be delivered to it.
      Overrides:
      forceFocus in class org.eclipse.swt.widgets.Control
      Returns:
      true if the control got focus, and false if it was unable to.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      setFocus()
    • setBackground

      public 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.

      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.

      Overrides:
      setBackground in class org.eclipse.swt.widgets.Control
      Parameters:
      color - the new color (or null)
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the argument has been disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setBackgroundImage

      public 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. The background image is tiled to fill the available space.

      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.

      Overrides:
      setBackgroundImage in class org.eclipse.swt.widgets.Control
      Parameters:
      image - the new image (or null)
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the argument has been disposed
      • ERROR_INVALID_ARGUMENT - if the argument is not a bitmap
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setCursor

      public 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.

      When the mouse pointer passes over a control its appearance is changed to match the control's cursor.

      Overrides:
      setCursor in class org.eclipse.swt.widgets.Control
      Parameters:
      cursor - the new cursor (or null)
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the argument has been disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setEnabled

      public void setEnabled​(boolean enabled)
      Enables the receiver if the argument is true, and disables it otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.
      Overrides:
      setEnabled in class org.eclipse.swt.widgets.Control
      Parameters:
      enabled - the new enabled state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setFont

      public 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.
      Overrides:
      setFont in class org.eclipse.swt.widgets.Control
      Parameters:
      font - the new font (or null)
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the argument has been disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setForeground

      public 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.

      Note: This operation is a hint and may be overridden by the platform.

      Overrides:
      setForeground in class org.eclipse.swt.widgets.Control
      Parameters:
      color - the new color (or null)
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the argument has been disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setMenu

      public void setMenu​(org.eclipse.swt.widgets.Menu menu)
      Sets the receiver's pop up menu to the argument. All controls may optionally have a pop up menu that is displayed when the user requests one for the control. The sequence of key strokes, button presses and/or button releases that are used to request a pop up menu is platform specific.

      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.

      Overrides:
      setMenu in class org.eclipse.swt.widgets.Control
      Parameters:
      menu - the new pop up menu
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu
      • ERROR_INVALID_PARENT - if the menu is not in the same widget tree
      • ERROR_INVALID_ARGUMENT - if the menu has been disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setToolTipText

      public 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. For a control that has a default tool tip, such as the Tree control on Windows, setting the tool tip text to an empty string replaces the default, causing no tool tip text to be shown.

      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.

      Overrides:
      setToolTipText in class org.eclipse.swt.widgets.Control
      Parameters:
      string - the new tool tip text (or null)
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver