Class RoundedSwitch
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.swt.widgets.Canvas
org.eclipse.nebula.widgets.roundedswitch.RoundedSwitch
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class RoundedSwitch
extends org.eclipse.swt.widgets.Canvas
Instances of this class provide a checkbox button displayed as a switch.
Please notive that this widget draws only the checkbox (you can not attach a text like regular
Please notive that this widget draws only the checkbox (you can not attach a text like regular
Button
SWT Widget)
- Styles:
- BORDER
- Events:
- Selection
-
Field Summary
-
Constructor Summary
Constructors Constructor Description RoundedSwitch(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
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 theSelectionListener
interface.org.eclipse.swt.graphics.Point
computeSize(int wHint, int hHint, boolean changed)
org.eclipse.swt.graphics.Color
getBackgroundColorCheckedDisabled()
Returns the background's color when the widget is checked and disabled.org.eclipse.swt.graphics.Color
getBackgroundColorCheckedEnabled()
Returns the background's color when the widget is checked and enabled.org.eclipse.swt.graphics.Color
getBackgroundColorUncheckedDisabled()
Returns the background's color when the widget is unchecked and disabled.org.eclipse.swt.graphics.Color
getBackgroundColorUncheckedEnabled()
Returns the background's color when the widget is unchecked and enabled.org.eclipse.swt.graphics.Color
getBorderColorCheckedDisabled()
Returns the border's color when the widget is checked and disabled.org.eclipse.swt.graphics.Color
getBorderColorCheckedEnabled()
Returns the border's color when the widget is checked and enabled.org.eclipse.swt.graphics.Color
getBorderColorUncheckedDisabled()
Returns the border's color when the widget is unchecked and disabled.org.eclipse.swt.graphics.Color
getBorderColorUncheckedEnabled()
Returns the border's color when the widget is unchecked and enabled.int
getBorderWidth()
Returns the receiver's border widthorg.eclipse.swt.graphics.Color
getCircleColorCheckedDisabled()
Returns the circle's color when the widget is checked and disabled.org.eclipse.swt.graphics.Color
getCircleColorCheckedEnabled()
Returns the circle's color when the widget is checked and enabled.org.eclipse.swt.graphics.Color
getCircleColorUncheckedDisabled()
Returns the circle's color when the widget is unchecked and disabled.org.eclipse.swt.graphics.Color
getCircleColorUncheckedEnabled()
Returns the circle's color when the widget is unchecked and enabled.boolean
getSelection()
Returnstrue
if the receiver is selected, and false otherwise.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
setBackgroundColorCheckedDisabled(org.eclipse.swt.graphics.Color color)
Sets the background's color when when the widget is checked and disabled or to the default system color for the control if the argument is null.void
setBackgroundColorCheckedEnabled(org.eclipse.swt.graphics.Color color)
Sets the background's color when when the widget is checked and enabled or to the default system color for the control if the argument is null.void
setBackgroundColorUncheckedDisabled(org.eclipse.swt.graphics.Color color)
Sets the background's color when when the widget is unchecked and disabled or to the default system color for the control if the argument is null.void
setBackgroundColorUncheckedEnabled(org.eclipse.swt.graphics.Color color)
Sets the background's color when when the widget is unchecked and enabled or to the default system color for the control if the argument is null.void
setBorderColorCheckedDisabled(org.eclipse.swt.graphics.Color color)
Sets the border's color when when the widget is checked and disabled or to the default system color for the control if the argument is null.void
setBorderColorCheckedEnabled(org.eclipse.swt.graphics.Color color)
Sets the border's color when when the widget is checked and enabled or to the default system color for the control if the argument is null.void
setBorderColorUncheckedDisabled(org.eclipse.swt.graphics.Color color)
Sets the border's color when when the widget is unchecked and disabled or to the default system color for the control if the argument is null.void
setBorderColorUncheckedEnabled(org.eclipse.swt.graphics.Color color)
Sets the border's color when when the widget is unchecked and enabled or to the default system color for the control if the argument is null.void
setBorderWidth(int borderWidth)
Sets the receiver's border widthvoid
setCircleColorCheckedDisabled(org.eclipse.swt.graphics.Color color)
Sets the circle's color when when the widget is checked and disabled or to the default system color for the control if the argument is null.void
setCircleColorCheckedEnabled(org.eclipse.swt.graphics.Color color)
Sets the circle's color when when the widget is checked and enabled or to the default system color for the control if the argument is null.void
setCircleColorUncheckedDisabled(org.eclipse.swt.graphics.Color color)
Sets the circle's color when when the widget is unchecked and disabled or to the default system color for the control if the argument is null.void
setCircleColorUncheckedEnabled(org.eclipse.swt.graphics.Color color)
Sets the circle's color when when the widget is unchecked and enabled or to the default system color for the control if the argument is null.void
setSelection(boolean selected)
Sets the selection state of the receiver.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, 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, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, 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, 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
-
Constructor Details
-
RoundedSwitch
public RoundedSwitch(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 theint
"|" operator) two or more of thoseSWT
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 Details
-
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 theSelectionListener
interface.widgetDefaultSelected
is not called.- 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
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)- Overrides:
computeSize
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.computeSize(int, int, boolean)
-
getSelection
public boolean getSelection()Returnstrue
if the receiver is selected, and false otherwise.- Returns:
- the selection 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
-
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)
-
setSelection
public void setSelection(boolean selected)Sets the selection state of the receiver.- Parameters:
selected
- the new selection 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
-
getBorderWidth
public int getBorderWidth()Returns the receiver's border width- Overrides:
getBorderWidth
in classorg.eclipse.swt.widgets.Control
- Returns:
- the border width
- 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
-
setBorderWidth
public void setBorderWidth(int borderWidth)Sets the receiver's border width- Parameters:
borderWidth
- the new border width- 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
-
getBorderColorCheckedEnabled
public org.eclipse.swt.graphics.Color getBorderColorCheckedEnabled()Returns the border's color when the widget is checked and enabled.- Returns:
- the border's color
- 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
-
setBorderColorCheckedEnabled
public void setBorderColorCheckedEnabled(org.eclipse.swt.graphics.Color color)Sets the border's color when when the widget is checked and enabled or to the default system color for the control if the argument is null.- 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
-
getBorderColorUncheckedEnabled
public org.eclipse.swt.graphics.Color getBorderColorUncheckedEnabled()Returns the border's color when the widget is unchecked and enabled.- Returns:
- the border's color
- 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
-
setBorderColorUncheckedEnabled
public void setBorderColorUncheckedEnabled(org.eclipse.swt.graphics.Color color)Sets the border's color when when the widget is unchecked and enabled or to the default system color for the control if the argument is null.- 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
-
getBorderColorCheckedDisabled
public org.eclipse.swt.graphics.Color getBorderColorCheckedDisabled()Returns the border's color when the widget is checked and disabled.- Returns:
- the border's color
- 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
-
setBorderColorCheckedDisabled
public void setBorderColorCheckedDisabled(org.eclipse.swt.graphics.Color color)Sets the border's color when when the widget is checked and disabled or to the default system color for the control if the argument is null.- 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
-
getBorderColorUncheckedDisabled
public org.eclipse.swt.graphics.Color getBorderColorUncheckedDisabled()Returns the border's color when the widget is unchecked and disabled.- Returns:
- the border's color
- 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
-
setBorderColorUncheckedDisabled
public void setBorderColorUncheckedDisabled(org.eclipse.swt.graphics.Color color)Sets the border's color when when the widget is unchecked and disabled or to the default system color for the control if the argument is null.- 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
-
getCircleColorCheckedEnabled
public org.eclipse.swt.graphics.Color getCircleColorCheckedEnabled()Returns the circle's color when the widget is checked and enabled.- Returns:
- the circle's color
- 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
-
setCircleColorCheckedEnabled
public void setCircleColorCheckedEnabled(org.eclipse.swt.graphics.Color color)Sets the circle's color when when the widget is checked and enabled or to the default system color for the control if the argument is null.- 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
-
getCircleColorUncheckedEnabled
public org.eclipse.swt.graphics.Color getCircleColorUncheckedEnabled()Returns the circle's color when the widget is unchecked and enabled.- Returns:
- the circle's color
- 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
-
setCircleColorUncheckedEnabled
public void setCircleColorUncheckedEnabled(org.eclipse.swt.graphics.Color color)Sets the circle's color when when the widget is unchecked and enabled or to the default system color for the control if the argument is null.- 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
-
getCircleColorCheckedDisabled
public org.eclipse.swt.graphics.Color getCircleColorCheckedDisabled()Returns the circle's color when the widget is checked and disabled.- Returns:
- the circle's color
- 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
-
setCircleColorCheckedDisabled
public void setCircleColorCheckedDisabled(org.eclipse.swt.graphics.Color color)Sets the circle's color when when the widget is checked and disabled or to the default system color for the control if the argument is null.- 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
-
getCircleColorUncheckedDisabled
public org.eclipse.swt.graphics.Color getCircleColorUncheckedDisabled()Returns the circle's color when the widget is unchecked and disabled.- Returns:
- the circle's color
- 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
-
setCircleColorUncheckedDisabled
public void setCircleColorUncheckedDisabled(org.eclipse.swt.graphics.Color color)Sets the circle's color when when the widget is unchecked and disabled or to the default system color for the control if the argument is null.- 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
-
getBackgroundColorCheckedEnabled
public org.eclipse.swt.graphics.Color getBackgroundColorCheckedEnabled()Returns the background's color when the widget is checked and enabled.- Returns:
- the background's color
- 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
-
setBackgroundColorCheckedEnabled
public void setBackgroundColorCheckedEnabled(org.eclipse.swt.graphics.Color color)Sets the background's color when when the widget is checked and enabled or to the default system color for the control if the argument is null.- 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
-
getBackgroundColorUncheckedEnabled
public org.eclipse.swt.graphics.Color getBackgroundColorUncheckedEnabled()Returns the background's color when the widget is unchecked and enabled.- Returns:
- the background's color
- 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
-
setBackgroundColorUncheckedEnabled
public void setBackgroundColorUncheckedEnabled(org.eclipse.swt.graphics.Color color)Sets the background's color when when the widget is unchecked and enabled or to the default system color for the control if the argument is null.- 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
-
getBackgroundColorCheckedDisabled
public org.eclipse.swt.graphics.Color getBackgroundColorCheckedDisabled()Returns the background's color when the widget is checked and disabled.- Returns:
- the background's color
- 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
-
setBackgroundColorCheckedDisabled
public void setBackgroundColorCheckedDisabled(org.eclipse.swt.graphics.Color color)Sets the background's color when when the widget is checked and disabled or to the default system color for the control if the argument is null.- 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
-
getBackgroundColorUncheckedDisabled
public org.eclipse.swt.graphics.Color getBackgroundColorUncheckedDisabled()Returns the background's color when the widget is unchecked and disabled.- Returns:
- the background's color
- 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
-
setBackgroundColorUncheckedDisabled
public void setBackgroundColorUncheckedDisabled(org.eclipse.swt.graphics.Color color)Sets the background's color when when the widget is unchecked and disabled or to the default system color for the control if the argument is null.- 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
-