Class SwitchButton

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

    public class SwitchButton
    extends org.eclipse.swt.widgets.Canvas
    Instances of this class are simple switch button.
    Styles:
    (none)
    Events:
    Selection
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int arc
      Arc of rounded rectangles (default is 3)
      private org.eclipse.swt.graphics.Color borderColor
      if not null, displays a rectangle (or a round rectangle) around the whole widget.
      private org.eclipse.swt.graphics.Color buttonBackgroundColor1
      Colors for the button
      private org.eclipse.swt.graphics.Color buttonBackgroundColor2
      Colors for the button
      private org.eclipse.swt.graphics.Color buttonBorderColor
      Colors for the button
      private org.eclipse.swt.graphics.Color focusColor
      if not null, displays a glow effect when the mouse is over the widget.
      private int gap
      Gap between the button and the text (default value is 5)
      private org.eclipse.swt.graphics.GC gc
      Graphical context for this button
      private int insideMarginX
      Margin inside the button (default is 5)
      private int insideMarginY
      Margin inside the button (default is 5)
      private java.util.List<org.eclipse.swt.events.SelectionListener> listOfSelectionListeners
      List of selection listeners
      private boolean mouseInside
      True when the mouse entered the widget
      private boolean round
      If true, display round rectangles instead of rectangles (default value is true)
      private org.eclipse.swt.graphics.Color selectedBackgroundColor
      Colors when the button is selected
      private org.eclipse.swt.graphics.Color selectedForegroundColor
      Colors when the button is selected
      private boolean selection
      Selection
      private java.lang.String text
      Text corresponding to the button (default is "")
      private java.lang.String textForSelect
      Text displayed for the selected value (default = "On")
      private java.lang.String textForUnselect
      Text displayed for the unselected value (default = "Off")
      private org.eclipse.swt.graphics.Color unselectedBackgroundColor
      Colors when the button is not selected
      private org.eclipse.swt.graphics.Color unselectedForegroundColor
      Colors when the button is not selected
      • Fields inherited from class org.eclipse.swt.widgets.Composite

        embeddedHandle
      • Fields inherited from class org.eclipse.swt.widgets.Widget

        handle
    • Constructor Summary

      Constructors 
      Constructor Description
      SwitchButton​(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
      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.
      private org.eclipse.swt.graphics.Point computeButtonSize()  
      org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint, boolean changed)  
      private void drawBorder()
      Draw (eventually) the border around the button
      private void drawLeftPart​(org.eclipse.swt.graphics.Point buttonSize)
      Draw the left part of the button
      private void drawRightPart​(org.eclipse.swt.graphics.Point buttonSize)
      Draw the right part of the button
      private void drawSwitchButton​(org.eclipse.swt.graphics.Point buttonSize)
      Draw the switch button
      private void drawText​(org.eclipse.swt.graphics.Point buttonSize)
      Draws the text besides the button
      private void drawToggleButton​(org.eclipse.swt.graphics.Point buttonSize)
      Draw the toggle button
      private boolean fireSelectionListeners​(org.eclipse.swt.widgets.Event e)
      Fire the selection listeners
      int getArc()  
      org.eclipse.swt.graphics.Color getBorderColor()  
      org.eclipse.swt.graphics.Color getButtonBackgroundColor1()  
      org.eclipse.swt.graphics.Color getButtonBackgroundColor2()  
      org.eclipse.swt.graphics.Color getButtonBorderColor()  
      org.eclipse.swt.graphics.Color getFocusColor()  
      int getGap()  
      org.eclipse.swt.graphics.Point getInsideMargin()  
      org.eclipse.swt.graphics.Color getSelectedBackgroundColor()  
      org.eclipse.swt.graphics.Color getSelectedForegroundColor()  
      boolean getSelection()  
      java.lang.String getText()  
      java.lang.String getTextForSelect()  
      java.lang.String getTextForUnselect()  
      org.eclipse.swt.graphics.Color getUnselectedBackgroundColor()  
      org.eclipse.swt.graphics.Color getUnselectedForegroundColor()  
      boolean isRound()  
      private void onPaint​(org.eclipse.swt.events.PaintEvent event)
      Paint the widget
      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 setArc​(int arc)  
      void setBorderColor​(org.eclipse.swt.graphics.Color borderColor)  
      void setButtonBackgroundColor1​(org.eclipse.swt.graphics.Color buttonBackgroundColor1)  
      void setButtonBackgroundColor2​(org.eclipse.swt.graphics.Color buttonBackgroundColor2)  
      void setButtonBorderColor​(org.eclipse.swt.graphics.Color buttonBorderColor)  
      void setFocusColor​(org.eclipse.swt.graphics.Color focusColor)  
      void setGap​(int gap)  
      void setInsideMargin​(int insideMarginX, int insideMarginY)  
      void setInsideMargin​(org.eclipse.swt.graphics.Point insideMargin)  
      void setRound​(boolean round)  
      void setSelectedBackgroundColor​(org.eclipse.swt.graphics.Color selectedBackgroundColor)  
      void setSelectedForegroundColor​(org.eclipse.swt.graphics.Color selectedForegroundColor)  
      void setSelection​(boolean selection)  
      void setText​(java.lang.String text)  
      void setTextForSelect​(java.lang.String textForSelect)  
      void setTextForUnselect​(java.lang.String textForUnselect)  
      void setUnselectedBackgroundColor​(org.eclipse.swt.graphics.Color unselectedBackgroundColor)  
      void setUnselectedForegroundColor​(org.eclipse.swt.graphics.Color unselectedForegroundColor)  
      • 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, setToolTipText, 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, toString
      • Methods inherited from class java.lang.Object

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

      • selection

        private boolean selection
        Selection
      • textForSelect

        private java.lang.String textForSelect
        Text displayed for the selected value (default = "On")
      • textForUnselect

        private java.lang.String textForUnselect
        Text displayed for the unselected value (default = "Off")
      • text

        private java.lang.String text
        Text corresponding to the button (default is "")
      • round

        private boolean round
        If true, display round rectangles instead of rectangles (default value is true)
      • borderColor

        private org.eclipse.swt.graphics.Color borderColor
        if not null, displays a rectangle (or a round rectangle) around the whole widget. Default value is null.
      • focusColor

        private org.eclipse.swt.graphics.Color focusColor
        if not null, displays a glow effect when the mouse is over the widget. Default value is null.
      • selectedForegroundColor

        private org.eclipse.swt.graphics.Color selectedForegroundColor
        Colors when the button is selected
      • selectedBackgroundColor

        private org.eclipse.swt.graphics.Color selectedBackgroundColor
        Colors when the button is selected
      • unselectedForegroundColor

        private org.eclipse.swt.graphics.Color unselectedForegroundColor
        Colors when the button is not selected
      • unselectedBackgroundColor

        private org.eclipse.swt.graphics.Color unselectedBackgroundColor
        Colors when the button is not selected
      • buttonBorderColor

        private org.eclipse.swt.graphics.Color buttonBorderColor
        Colors for the button
      • buttonBackgroundColor1

        private org.eclipse.swt.graphics.Color buttonBackgroundColor1
        Colors for the button
      • buttonBackgroundColor2

        private org.eclipse.swt.graphics.Color buttonBackgroundColor2
        Colors for the button
      • gap

        private int gap
        Gap between the button and the text (default value is 5)
      • insideMarginX

        private int insideMarginX
        Margin inside the button (default is 5)
      • insideMarginY

        private int insideMarginY
        Margin inside the button (default is 5)
      • arc

        private int arc
        Arc of rounded rectangles (default is 3)
      • gc

        private org.eclipse.swt.graphics.GC gc
        Graphical context for this button
      • listOfSelectionListeners

        private final java.util.List<org.eclipse.swt.events.SelectionListener> listOfSelectionListeners
        List of selection listeners
      • mouseInside

        private boolean mouseInside
        True when the mouse entered the widget
    • Constructor Detail

      • SwitchButton

        public SwitchButton​(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
    • Method Detail

      • onPaint

        private void onPaint​(org.eclipse.swt.events.PaintEvent event)
        Paint the widget
        Parameters:
        event - paint event
      • drawSwitchButton

        private void drawSwitchButton​(org.eclipse.swt.graphics.Point buttonSize)
        Draw the switch button
        Parameters:
        buttonSize - size of the button
      • drawRightPart

        private void drawRightPart​(org.eclipse.swt.graphics.Point buttonSize)
        Draw the right part of the button
        Parameters:
        buttonSize - size of the button
      • drawLeftPart

        private void drawLeftPart​(org.eclipse.swt.graphics.Point buttonSize)
        Draw the left part of the button
        Parameters:
        buttonSize - size of the button
      • drawToggleButton

        private void drawToggleButton​(org.eclipse.swt.graphics.Point buttonSize)
        Draw the toggle button
        Parameters:
        buttonSize - size of the button
      • computeButtonSize

        private org.eclipse.swt.graphics.Point computeButtonSize()
        Returns:
        the button size
      • drawText

        private void drawText​(org.eclipse.swt.graphics.Point buttonSize)
        Draws the text besides the button
        Parameters:
        buttonSize - whole size of the button
      • drawBorder

        private void drawBorder()
        Draw (eventually) the border around the button
      • fireSelectionListeners

        private boolean fireSelectionListeners​(org.eclipse.swt.widgets.Event e)
        Fire the selection listeners
        Parameters:
        e - mouse event
        Returns:
        true if the selection could be changed, false otherwise
      • 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 called when the control is selected by the user. 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), SelectionEvent
      • 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)
      • 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)
      • getSelection

        public boolean getSelection()
        Returns:
        the selection state of the button
        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​(boolean selection)
        Parameters:
        selection - the selection state of the button
        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
      • getTextForSelect

        public java.lang.String getTextForSelect()
        Returns:
        the text used to display 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
      • setTextForSelect

        public void setTextForSelect​(java.lang.String textForSelect)
        Parameters:
        textForSelect - the text used to display 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
      • getTextForUnselect

        public java.lang.String getTextForUnselect()
        Returns:
        the text used to display the unselected option
        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
      • setTextForUnselect

        public void setTextForUnselect​(java.lang.String textForUnselect)
        Parameters:
        textForUnselect - the text used to display the unselected option
        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:
        the text displayed in 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
      • setText

        public void setText​(java.lang.String text)
        Parameters:
        the - text displayed in 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
      • isRound

        public boolean isRound()
        Returns:
        the round flag
        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
      • setRound

        public void setRound​(boolean round)
        Parameters:
        round - the round flag to set. If true, the widget is composed of round rectangle instead of rectangles
        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
      • getBorderColor

        public org.eclipse.swt.graphics.Color getBorderColor()
        Returns:
        the border's color. If null, no border is displayed
        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
      • setBorderColor

        public void setBorderColor​(org.eclipse.swt.graphics.Color borderColor)
        Parameters:
        borderColor - the border's color. If null, no border is displayed.
        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
      • getFocusColor

        public org.eclipse.swt.graphics.Color getFocusColor()
        Returns:
        the focus color. If null, no focus effect is displayed.
        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
      • setFocusColor

        public void setFocusColor​(org.eclipse.swt.graphics.Color focusColor)
        Parameters:
        focusColor - the focus color to set. If null, no focus effect is displayed.
        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
      • getSelectedForegroundColor

        public org.eclipse.swt.graphics.Color getSelectedForegroundColor()
        Returns:
        the foreground color of the left part of the widget (selection is on)
        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
      • setSelectedForegroundColor

        public void setSelectedForegroundColor​(org.eclipse.swt.graphics.Color selectedForegroundColor)
        Parameters:
        the - foreground color of the left part of the widget (selection is on)
        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
      • getSelectedBackgroundColor

        public org.eclipse.swt.graphics.Color getSelectedBackgroundColor()
        Returns:
        the background color of the left part of the widget (selection is on)
        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
      • setSelectedBackgroundColor

        public void setSelectedBackgroundColor​(org.eclipse.swt.graphics.Color selectedBackgroundColor)
        Parameters:
        the - background color of the left part of the widget (selection is on)
      • getUnselectedForegroundColor

        public org.eclipse.swt.graphics.Color getUnselectedForegroundColor()
        Returns:
        the foreground color of the left part of the widget (selection is on)
        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
      • setUnselectedForegroundColor

        public void setUnselectedForegroundColor​(org.eclipse.swt.graphics.Color unselectedForegroundColor)
        Parameters:
        unselectedForegroundColor - the foreground color of the left part of the widget (selection is on)
        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
      • getUnselectedBackgroundColor

        public org.eclipse.swt.graphics.Color getUnselectedBackgroundColor()
        Returns:
        the background color of the left part of the widget (selection is on)
        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
      • setUnselectedBackgroundColor

        public void setUnselectedBackgroundColor​(org.eclipse.swt.graphics.Color unselectedBackgroundColor)
        Parameters:
        unselectedBackgroundColor - the background color of the left part of the widget (selection is on)
        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
      • getButtonBorderColor

        public org.eclipse.swt.graphics.Color getButtonBorderColor()
        Returns:
        the border color of the switch button
        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
      • setButtonBorderColor

        public void setButtonBorderColor​(org.eclipse.swt.graphics.Color buttonBorderColor)
        Parameters:
        buttonBorderColor - the border color of the switch button
        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
      • getButtonBackgroundColor1

        public org.eclipse.swt.graphics.Color getButtonBackgroundColor1()
        Returns:
        the first color of the toggle button
        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
      • setButtonBackgroundColor1

        public void setButtonBackgroundColor1​(org.eclipse.swt.graphics.Color buttonBackgroundColor1)
        Parameters:
        buttonBackgroundColor1 - the first color of the toggle button
        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
      • getButtonBackgroundColor2

        public org.eclipse.swt.graphics.Color getButtonBackgroundColor2()
        Returns:
        the second color of the toggle button
        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
      • setButtonBackgroundColor2

        public void setButtonBackgroundColor2​(org.eclipse.swt.graphics.Color buttonBackgroundColor2)
        Parameters:
        buttonBackgroundColor2 - the second color of the toggle button
        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
      • getGap

        public int getGap()
        Returns:
        the gap 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
      • setGap

        public void setGap​(int gap)
        Parameters:
        gap - the gap value to set
        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
      • getInsideMargin

        public org.eclipse.swt.graphics.Point getInsideMargin()
        Returns:
        the margin 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
      • setInsideMargin

        public void setInsideMargin​(int insideMarginX,
                                    int insideMarginY)
        Parameters:
        insideMarginX - the new margin value (horizontal)
        insideMarginY - the new margin value (vertical)
        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
      • setInsideMargin

        public void setInsideMargin​(org.eclipse.swt.graphics.Point insideMargin)
        Parameters:
        insideMargin - the new margin 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
      • getArc

        public int getArc()
        Returns:
        the arc 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
      • setArc

        public void setArc​(int arc)
        Parameters:
        arc - the arc value to set
        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