Class RoundedCheckbox
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.roundedcheckbox.RoundedCheckbox
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class RoundedCheckbox
extends org.eclipse.swt.widgets.Canvas
Instances of this class provide a checkbox button.
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 RoundedCheckbox(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)
boolean
getGrayed()
Returnstrue
if the receiver is grayed, and false otherwise.org.eclipse.swt.graphics.Color
getHoverColor()
Returns the receiver's color when the mouse is hover the widget.org.eclipse.swt.graphics.Color
getSelectedBackgroundColor()
Returns the receiver's background color when the widget is selected.org.eclipse.swt.graphics.Color
getSelectedForegroundColor()
Returns the receiver's foreground color when the widget is selected.boolean
getSelection()
Returnstrue
if the receiver is selected, and false otherwise.org.eclipse.swt.graphics.Color
getUnselectedColor()
Returns the receiver's foreground color when the widget is not selected.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
setGrayed(boolean grayed)
Sets the grayed state of the receiver.void
setHoverColor(org.eclipse.swt.graphics.Color color)
Sets the button's color when the mouse is hover the widget to the color specified by the argument, or to the default system color for the control if the argument is null.void
setSelectedBackgroundColor(org.eclipse.swt.graphics.Color color)
Sets the button's background color when the widget is selected to the color specified by the argument, or to the default system color for the control if the argument is null.void
setSelectedForegroundColor(org.eclipse.swt.graphics.Color color)
Sets the button's foreground color when the widget is selected to the color specified by the argument, 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.void
setUnselectedColor(org.eclipse.swt.graphics.Color color)
Sets the button's drawing color when the widget is not selected to the color specified by the argument, or to the default system color for the control if the argument is null.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, 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
-
Constructor Details
-
RoundedCheckbox
public RoundedCheckbox(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)
-
getGrayed
public boolean getGrayed()Returnstrue
if the receiver is grayed, and false otherwise.- Returns:
- the grayed state of the checkbox
- 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
- Since:
- 3.4
-
getHoverColor
public org.eclipse.swt.graphics.Color getHoverColor()Returns the receiver's color when the mouse is hover the widget.- Returns:
- the receiver'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
-
getSelectedBackgroundColor
public org.eclipse.swt.graphics.Color getSelectedBackgroundColor()Returns the receiver's background color when the widget is selected.- Returns:
- the background 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
-
getSelectedForegroundColor
public org.eclipse.swt.graphics.Color getSelectedForegroundColor()Returns the receiver's foreground color when the widget is selected.- Returns:
- the foreground 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
-
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
-
getUnselectedColor
public org.eclipse.swt.graphics.Color getUnselectedColor()Returns the receiver's foreground color when the widget is not selected.- Returns:
- the foreground 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
-
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)
-
setGrayed
public void setGrayed(boolean grayed)Sets the grayed state of the receiver. This state change only applies if the control was created with the SWT.CHECK style.- Parameters:
grayed
- the new grayed 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
-
setHoverColor
public void setHoverColor(org.eclipse.swt.graphics.Color color)Sets the button's color when the mouse is hover the widget to the color specified by the argument, 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
-
setSelectedBackgroundColor
public void setSelectedBackgroundColor(org.eclipse.swt.graphics.Color color)Sets the button's background color when the widget is selected to the color specified by the argument, 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
-
setSelectedForegroundColor
public void setSelectedForegroundColor(org.eclipse.swt.graphics.Color color)Sets the button's foreground color when the widget is selected to the color specified by the argument, 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
-
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
-
setUnselectedColor
public void setUnselectedColor(org.eclipse.swt.graphics.Color color)Sets the button's drawing color when the widget is not selected to the color specified by the argument, 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
-