Class RangeSlider

  • All Implemented Interfaces:
    org.eclipse.swt.graphics.Drawable

    public class RangeSlider
    extends org.eclipse.swt.widgets.Canvas
    Instances of this class provide a slider with two thumbs to control lower and upper integer values.

    Styles:
    BORDER
    HORIZONTAL
    VERTICAL
    CONTROL - Allow key and mouse manipulation to control both lower and upper value thumbs simultaneously
    ON - Indicates that selection listeners are notified continuously during thumb drag events. Otherwise, notification occurs only after the drag event terminates.
    HIGH - Indicates high quality tick marks are generated dynamically to a factor of the pageIncrement or increment. Otherwise, tick marks divide the scale evenly into ten parts.
    SMOOTH - Indicates mouse manipulation of upper and lower values are computed smoothly from the exact mouse cursor position disregarding the increment value. Otherwise, values are constrained to an incremental value.
    Events:
    Selection

    Note: Styles HORIZONTAL and VERTICAL are mutually exclusive.

    • Constructor Summary

      Constructors 
      Constructor Description
      RangeSlider​(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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void addMouseListeners()
      Add the mouse listeners (mouse up, mouse down, mouse move, mouse wheel)
      void addSelectionListener​(org.eclipse.swt.events.SelectionListener listener)
      Adds the listener to the collection of listeners who will be notified when the user changes the receiver's value, by sending it one of the messages defined in the SelectionListener interface.
      private void checkLowerValue()
      Check if the lower value is in ranges
      private void checkUpperValue()
      Check if the upper value is in ranges
      private float computePixelSizeForHorizontalSlider()  
      private float computePixelSizeForVerticalSlider()  
      org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint, boolean changed)  
      private void drawBackgroundHorizontal​(org.eclipse.swt.graphics.GC gc)
      Draw the background
      private void drawBackgroundVertical​(org.eclipse.swt.graphics.GC gc)
      Draws the background
      private void drawBarsHorizontal​(org.eclipse.swt.graphics.GC gc)
      Draw the bars
      private void drawBarsVertical​(org.eclipse.swt.graphics.GC gc)
      Draws the bars
      private org.eclipse.swt.graphics.Point drawHorizontalKnob​(org.eclipse.swt.graphics.GC gc, int value, boolean upper)
      Draws an horizontal knob
      private void drawHorizontalRangeSlider​(org.eclipse.swt.graphics.GC gc)
      Draw the range slider (horizontal)
      private org.eclipse.swt.graphics.Point drawVerticalKnob​(org.eclipse.swt.graphics.GC gc, int value, boolean upper)
      Draws a vertical knob
      private void drawVerticalRangeSlider​(org.eclipse.swt.graphics.GC gc)
      Draw the range slider (vertical)
      private void drawWidget​(org.eclipse.swt.events.PaintEvent e)
      Draws the widget
      private boolean fireSelectionListeners​(org.eclipse.swt.widgets.Event event)
      Fire all selection listeners
      private int getCursorValue​(int x, int y)
      if the input coordinate is within the scale bounds, return the corresponding scale value of the coordinate.
      int getIncrement()
      Returns the amount that the selected receiver's value will be modified by when the up/down (or right/left) arrows are pressed.
      int getLowerValue()
      Returns the 'lower selection', which is the lower receiver's position.
      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 selected receiver's value will be modified by when the page increment/decrement areas are selected.
      int[] getSelection()
      Returns the 'selection', which is an array where the first element is the lower selection, and the second element is the upper selection
      int getStyle()  
      int getUpperValue()
      Returns the 'upper selection', which is the upper receiver's position.
      private void handleKeyDown​(org.eclipse.swt.widgets.Event event)
      Code executed when a key is typed
      private void handleMouseDoubleClick​(org.eclipse.swt.widgets.Event e)
      Code executed when the mouse double click
      private void handleMouseDown​(org.eclipse.swt.widgets.Event e)
      Code executed when the mouse is down
      private void handleMouseHover​(org.eclipse.swt.widgets.Event e)
      Code executed on mouse hover
      private void handleMouseMove​(org.eclipse.swt.widgets.Event e)
      Code executed when the mouse pointer is moving
      private void handleMouseUp​(org.eclipse.swt.widgets.Event e)
      Code executed when the mouse is up
      private void handleMouseWheel​(org.eclipse.swt.widgets.Event e)
      Code executed when the mouse wheel is activated
      private void handleToolTip​(int... values)
      set the tooltip if a toolTipFormatter is present.
      private boolean isBetweenKnobs​(int x, int y)
      determine whether the input coordinate is within the scale bounds and between the current upper and lower values.
      private void moveCursorPosition​(int xDelta, int yDelta)
      move the cursor location by the input delta values.
      void removeSelectionListener​(org.eclipse.swt.events.SelectionListener listener)
      Removes the listener from the collection of listeners who will be notified when the user changes the receiver's value.
      private void selectKnobs​(org.eclipse.swt.widgets.Event e)
      set the upperHover and lowerHover values according to the coordinates of the input event, the key modifier state, and whether the style allows selection of both knobs.
      void setExtrema​(int min, int max)
      Sets the minimum and maximum values that the receiver will allow.
      void setIncrement​(int increment)
      Sets the amount that the selected receiver's value will be modified by when the up/down (or right/left) arrows are pressed to the argument, which must be at least one.
      void setLowerValue​(int value)
      Sets the 'lower selection', which is the receiver's lower value, to the input argument which must be less than or equal to the current 'upper selection' and greater or equal to the minimum.
      void setMaximum​(int value)
      Sets the maximum value that the receiver will allow.
      void setMinimum​(int value)
      Sets the minimum value that the receiver will allow.
      void setPageIncrement​(int pageIncrement)
      Sets the amount that the receiver's value will be modified by when the page increment/decrement areas are selected to the argument, which must be at least one.
      void setSelection​(int[] values)
      Sets the 'selection', which is the receiver's value.
      void setSelection​(int lowerValue, int upperValue)
      Sets the 'selection', which is the receiver's value.
      protected void setTickFactors()
      reset the tickDivisions, tickFactor, and stride values according to current size.
      protected void setTickFactors​(float breadth)
      reset the tickDivisions, tickFactor, and stride values according to the input breadth.
      void setToolTipFormatter​(java.text.Format formatter)
      a formatter for displaying a tool tip when hovering over the scale and during thumb modification events.
      void setToolTipText​(java.lang.String string)  
      void setUpperValue​(int value)
      Sets the 'upper selection', which is the upper receiver's value, to the input argument which must be greater than or equal to the current 'lower selection' and less or equal to the maximum.
      private void translateValues​(int amount)
      translate both the upper and lower values by the input amount.
      private void validateNewValues​(org.eclipse.swt.widgets.Event e)
      invoke selection listeners if either upper or lower value has changed.
      • Methods inherited from class org.eclipse.swt.widgets.Canvas

        drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
      • Methods inherited from class org.eclipse.swt.widgets.Composite

        changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
      • 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, dragDetect, dragDetect, forceFocus, 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, isAutoScalable, 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, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, 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, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • minimum

        private int minimum
      • maximum

        private int maximum
      • lowerValue

        private int lowerValue
      • upperValue

        private int upperValue
      • listeners

        private final java.util.List<org.eclipse.swt.events.SelectionListener> listeners
      • slider

        private final org.eclipse.swt.graphics.Image slider
      • sliderHover

        private final org.eclipse.swt.graphics.Image sliderHover
      • sliderDrag

        private final org.eclipse.swt.graphics.Image sliderDrag
      • sliderSelected

        private final org.eclipse.swt.graphics.Image sliderSelected
      • vSlider

        private final org.eclipse.swt.graphics.Image vSlider
      • vSliderHover

        private final org.eclipse.swt.graphics.Image vSliderHover
      • vSliderDrag

        private final org.eclipse.swt.graphics.Image vSliderDrag
      • vSliderSelected

        private final org.eclipse.swt.graphics.Image vSliderSelected
      • orientation

        private int orientation
      • increment

        private int increment
      • pageIncrement

        private int pageIncrement
      • selectedElement

        private byte selectedElement
      • priorSelectedElement

        private byte priorSelectedElement
      • dragInProgress

        private boolean dragInProgress
      • upperHover

        private boolean upperHover
      • lowerHover

        private boolean lowerHover
      • previousUpperValue

        private int previousUpperValue
      • previousLowerValue

        private int previousLowerValue
      • startDragUpperValue

        private int startDragUpperValue
      • startDragLowerValue

        private int startDragLowerValue
      • startDragPoint

        private org.eclipse.swt.graphics.Point startDragPoint
      • hasFocus

        private boolean hasFocus
      • isSmooth

        private final boolean isSmooth
      • isFullSelection

        private final boolean isFullSelection
      • isHighQuality

        private final boolean isHighQuality
      • isOn

        private final boolean isOn
      • tickDivisions

        private int tickDivisions
      • stride

        private int stride
      • tickFactor

        private float tickFactor
      • toolTipFormatter

        private java.text.Format toolTipFormatter
      • clientToolTipText

        private java.lang.String clientToolTipText
      • toolTip

        private java.lang.StringBuffer toolTip
      • coordUpper

        private org.eclipse.swt.graphics.Point coordUpper
      • coordLower

        private org.eclipse.swt.graphics.Point coordLower
    • Constructor Detail

      • RangeSlider

        public RangeSlider​(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. Default style is HORIZONTAL
        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
        See Also:
        SWT.HORIZONTAL, SWT.VERTICAL, Widget.getStyle()
    • Method Detail

      • setTickFactors

        protected void setTickFactors()
        reset the tickDivisions, tickFactor, and stride values according to current size. if the current size is less than 40, no tick marks are produced.
      • setTickFactors

        protected void setTickFactors​(float breadth)
        reset the tickDivisions, tickFactor, and stride values according to the input breadth. we generate at least ten divisions, but fewer if the ticks are too compact. some factor of pageIncrement is the preferred tick division. if too few ticks are generated from pageIncrement then increment is used. if too few ticks are generated from increment some smaller value is used if style is SMOOTH.
      • getStyle

        public int getStyle()
        Overrides:
        getStyle in class org.eclipse.swt.widgets.Widget
      • addMouseListeners

        private void addMouseListeners()
        Add the mouse listeners (mouse up, mouse down, mouse move, mouse wheel)
      • handleMouseDown

        private void handleMouseDown​(org.eclipse.swt.widgets.Event e)
        Code executed when the mouse is down
        Parameters:
        e - event
      • handleMouseUp

        private void handleMouseUp​(org.eclipse.swt.widgets.Event e)
        Code executed when the mouse is up
        Parameters:
        e - event
      • validateNewValues

        private void validateNewValues​(org.eclipse.swt.widgets.Event e)
        invoke selection listeners if either upper or lower value has changed. if listeners reject the change, restore the previous values. redraw if either upper or lower value has changed.
        Parameters:
        e - event
      • fireSelectionListeners

        private boolean fireSelectionListeners​(org.eclipse.swt.widgets.Event event)
        Fire all selection listeners
        Parameters:
        event - selection event
        Returns:
        true if no listener cancels the selection, false otherwise
      • handleMouseMove

        private void handleMouseMove​(org.eclipse.swt.widgets.Event e)
        Code executed when the mouse pointer is moving
        Parameters:
        e - event
      • isBetweenKnobs

        private boolean isBetweenKnobs​(int x,
                                       int y)
        determine whether the input coordinate is within the scale bounds and between the current upper and lower values.
        Parameters:
        x -
        y -
        Returns:
      • selectKnobs

        private void selectKnobs​(org.eclipse.swt.widgets.Event e)
        set the upperHover and lowerHover values according to the coordinates of the input event, the key modifier state, and whether the style allows selection of both knobs.
        Parameters:
        e -
      • getCursorValue

        private int getCursorValue​(int x,
                                   int y)
        if the input coordinate is within the scale bounds, return the corresponding scale value of the coordinate. otherwise return -1.
        Parameters:
        x - x coordinate value
        y - y coordinate value
        Returns:
      • handleMouseDoubleClick

        private void handleMouseDoubleClick​(org.eclipse.swt.widgets.Event e)
        Code executed when the mouse double click
        Parameters:
        e - event
      • handleToolTip

        private void handleToolTip​(int... values)
        set the tooltip if a toolTipFormatter is present. either one or two values are accepted.
        Parameters:
        values -
      • handleMouseHover

        private void handleMouseHover​(org.eclipse.swt.widgets.Event e)
        Code executed on mouse hover
        Parameters:
        e - event
      • setToolTipFormatter

        public void setToolTipFormatter​(java.text.Format formatter)
        a formatter for displaying a tool tip when hovering over the scale and during thumb modification events. The Format.format(Object, StringBuffer, java.text.FieldPosition) method is invoked to retrieve the text for the tooltip where the input Object is an Integer with a value within the minimum and maximum.
        Parameters:
        formatter -
      • setToolTipText

        public void setToolTipText​(java.lang.String string)
        Overrides:
        setToolTipText in class org.eclipse.swt.widgets.Control
      • handleMouseWheel

        private void handleMouseWheel​(org.eclipse.swt.widgets.Event e)
        Code executed when the mouse wheel is activated
        Parameters:
        e - event
      • checkLowerValue

        private void checkLowerValue()
        Check if the lower value is in ranges
      • checkUpperValue

        private void checkUpperValue()
        Check if the upper value is in ranges
      • drawWidget

        private void drawWidget​(org.eclipse.swt.events.PaintEvent e)
        Draws the widget
        Parameters:
        e - paint event
      • drawHorizontalRangeSlider

        private void drawHorizontalRangeSlider​(org.eclipse.swt.graphics.GC gc)
        Draw the range slider (horizontal)
        Parameters:
        gc - graphic context
      • drawBackgroundHorizontal

        private void drawBackgroundHorizontal​(org.eclipse.swt.graphics.GC gc)
        Draw the background
        Parameters:
        gc - graphic context
      • computePixelSizeForHorizontalSlider

        private float computePixelSizeForHorizontalSlider()
        Returns:
        how many pixels corresponds to 1 point of value
      • drawBarsHorizontal

        private void drawBarsHorizontal​(org.eclipse.swt.graphics.GC gc)
        Draw the bars
        Parameters:
        gc - graphic context
      • drawHorizontalKnob

        private org.eclipse.swt.graphics.Point drawHorizontalKnob​(org.eclipse.swt.graphics.GC gc,
                                                                  int value,
                                                                  boolean upper)
        Draws an horizontal knob
        Parameters:
        gc - graphic context
        value - corresponding value
        upper - if true, draws the upper knob. If false, draws the lower knob
        Returns:
        the coordinate of the upper left corner of the knob
      • drawVerticalRangeSlider

        private void drawVerticalRangeSlider​(org.eclipse.swt.graphics.GC gc)
        Draw the range slider (vertical)
        Parameters:
        gc - graphic context
      • drawBackgroundVertical

        private void drawBackgroundVertical​(org.eclipse.swt.graphics.GC gc)
        Draws the background
        Parameters:
        gc - graphic context
      • computePixelSizeForVerticalSlider

        private float computePixelSizeForVerticalSlider()
        Returns:
        how many pixels corresponds to 1 point of value
      • drawBarsVertical

        private void drawBarsVertical​(org.eclipse.swt.graphics.GC gc)
        Draws the bars
        Parameters:
        gc - graphic context
      • drawVerticalKnob

        private org.eclipse.swt.graphics.Point drawVerticalKnob​(org.eclipse.swt.graphics.GC gc,
                                                                int value,
                                                                boolean upper)
        Draws a vertical knob
        Parameters:
        gc - graphic context
        value - corresponding value
        upper - if true, draws the upper knob. If false, draws the lower knob
        Returns:
        the coordinate of the upper left corner of the knob
      • moveCursorPosition

        private void moveCursorPosition​(int xDelta,
                                        int yDelta)
        move the cursor location by the input delta values.
        Parameters:
        xDelta -
        yDelta -
      • handleKeyDown

        private void handleKeyDown​(org.eclipse.swt.widgets.Event event)
        Code executed when a key is typed
        Parameters:
        event - event
      • translateValues

        private void translateValues​(int amount)
        translate both the upper and lower values by the input amount. The updated values are constrained to be within the minimum and maximum. The difference between upper and lower values is retained.
        Parameters:
        amount -
      • addSelectionListener

        public void addSelectionListener​(org.eclipse.swt.events.SelectionListener listener)
        Adds the listener to the collection of listeners who will be notified when the user changes the receiver's value, by sending it one of the messages defined in the SelectionListener interface.

        widgetSelected is called when the user changes the receiver's value. widgetDefaultSelected is not called.

        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:
        SelectionListener, removeSelectionListener(org.eclipse.swt.events.SelectionListener)
      • computeSize

        public org.eclipse.swt.graphics.Point computeSize​(int wHint,
                                                          int hHint,
                                                          boolean changed)
        Overrides:
        computeSize in class org.eclipse.swt.widgets.Control
        See Also:
        Control.computeSize(int, int, boolean)
      • getIncrement

        public int getIncrement()
        Returns the amount that the selected receiver's value will be modified by when the up/down (or right/left) 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
      • getLowerValue

        public int getLowerValue()
        Returns the 'lower selection', which is the lower 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
      • 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 selected receiver's value will be modified by when the page increment/decrement areas are selected.
        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 an array where the first element is the lower selection, and the second element is the upper selection
        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
      • getUpperValue

        public int getUpperValue()
        Returns the 'upper selection', which is the upper 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
      • removeSelectionListener

        public void removeSelectionListener​(org.eclipse.swt.events.SelectionListener listener)
        Removes the listener from the collection of listeners who will be notified when the user changes the receiver's value.
        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)
      • setIncrement

        public void setIncrement​(int increment)
        Sets the amount that the selected receiver's value will be modified by when the up/down (or right/left) arrows are pressed to the argument, which must be at least one.
        Parameters:
        increment - 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
      • setLowerValue

        public void setLowerValue​(int value)
        Sets the 'lower selection', which is the receiver's lower value, to the input argument which must be less than or equal to the current 'upper selection' and greater or equal to the minimum. If either condition fails, no action is taken.
        Parameters:
        value - the new lower 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
        See Also:
        getUpperValue(), getMinimum(), setSelection(int, int)
      • setMaximum

        public void setMaximum​(int value)
        Sets the maximum value that the receiver will allow. This new value will be ignored if it is not greater 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 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
        See Also:
        setExtrema(int, int)
      • setMinimum

        public void setMinimum​(int value)
        Sets the minimum value that the receiver will allow. This new value will be ignored if it is negative or is not less 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 nonnegative and less than 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
        See Also:
        setExtrema(int, int)
      • setExtrema

        public void setExtrema​(int min,
                               int max)
        Sets the minimum and maximum values that the receiver will allow. The new values will be ignored if either are negative or the min value is not less than the max. The receiver's selection values will be adjusted if necessary to fall within the new range.
        Parameters:
        min - the new minimum, which must be nonnegative and less than the max
        max - the new maximum, which must be greater than the min
        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 pageIncrement)
        Sets the amount that the receiver's value will be modified by when the page increment/decrement areas are selected to the argument, which must be at least one.
        Parameters:
        pageIncrement - 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[] values)
        Sets the 'selection', which is the receiver's value. The lower value must be less than or equal to the upper value. Additionally, both values must be inclusively between the slider minimum and maximum. If either condition fails, no action is taken.
        Parameters:
        value - the new selection (first value is lower value, second value is upper 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
      • setSelection

        public void setSelection​(int lowerValue,
                                 int upperValue)
        Sets the 'selection', which is the receiver's value. The lower value must be less than or equal to the upper value. Additionally, both values must be inclusively between the slider minimum and maximum. If either condition fails, no action is taken.
        Parameters:
        lowerValue - the new lower selection
        upperValue - the new upper 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
        See Also:
        getMinimum(), getMaximum()
      • setUpperValue

        public void setUpperValue​(int value)
        Sets the 'upper selection', which is the upper receiver's value, to the input argument which must be greater than or equal to the current 'lower selection' and less or equal to the maximum. If either condition fails, no action is taken.
        Parameters:
        value - the new upper 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
        See Also:
        getLowerValue(), getMaximum(), setSelection(int, int)