Class Chips
- 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.chips.Chips
-
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class Chips extends org.eclipse.swt.widgets.Canvas
Instances of this class represent a "chips". This is a kind of rounded-shapped button. It can display information, or be used like a check or a push button. You can also add a close button.- Styles:
- SWT.CLOSE
- SWT.CHECK
- SWT.PUSH
- Events:
- SWT.Close, SWT.Selection
-
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.swt.graphics.Color
borderColor
private org.eclipse.swt.graphics.Color
chipsBackground
private static int
CLOSE_CIRCLE_RAY
private org.eclipse.swt.graphics.Color
closeButtonBackground
private org.eclipse.swt.graphics.Color
closeButtonForeground
private org.eclipse.swt.graphics.Color
closeButtonHoverBackground
private org.eclipse.swt.graphics.Color
closeButtonHoverForeground
private org.eclipse.swt.graphics.Point
closeCenter
private java.util.List<CloseListener>
closeListeners
private boolean
cursorInside
private org.eclipse.swt.graphics.Color
hoverBackground
private org.eclipse.swt.graphics.Color
hoverBorderColor
private org.eclipse.swt.graphics.Color
hoverForeground
private org.eclipse.swt.graphics.Image
hoverImage
private org.eclipse.swt.graphics.Image
image
private boolean
isCheck
private boolean
isClose
private boolean
isPush
private org.eclipse.swt.graphics.Color
pushedStateBackground
private org.eclipse.swt.graphics.Color
pushedStateBorderColor
private org.eclipse.swt.graphics.Color
pushedStateForeground
private org.eclipse.swt.graphics.Image
pushImage
private boolean
selection
private java.util.List<org.eclipse.swt.events.SelectionListener>
selectionListeners
private java.lang.String
text
-
Constructor Summary
Constructors Constructor Description Chips(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 Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCloseListener(CloseListener listener)
Adds the listener to the collection of listeners who will be notified when the control is closed by the user, by sending it one of the messages defined in theCodeListener
interface.void
addListener(int eventType, org.eclipse.swt.widgets.Listener listener)
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.private static int
checkStyle(int style)
org.eclipse.swt.graphics.Point
computeSize(int wHint, int hHint, boolean changed)
private org.eclipse.swt.graphics.Color
determineBackgroundColor()
private int
drawBackground(org.eclipse.swt.graphics.GC gc)
private int
drawCheck(org.eclipse.swt.graphics.GC gc, int x)
private void
drawClose(org.eclipse.swt.graphics.GC gc, int x)
private int
drawImage(org.eclipse.swt.graphics.GC gc, int x)
private int
drawText(org.eclipse.swt.graphics.GC gc, int x)
private void
drawWidgetBorder(org.eclipse.swt.graphics.GC gc)
org.eclipse.swt.graphics.Color
getBorderColor()
Returns the receiver's color for the border of the widget.org.eclipse.swt.graphics.Color
getChipsBackground()
Returns the receiver's background color.org.eclipse.swt.graphics.Color
getCloseButtonBackground()
Returns the receiver's close item background color.org.eclipse.swt.graphics.Color
getCloseButtonForeground()
Returns the receiver's close item foreground color.org.eclipse.swt.graphics.Color
getCloseButtonHoverBackground()
Returns the receiver's close item background color when the mouse is hover the widget.org.eclipse.swt.graphics.Color
getCloseButtonHoverForeground()
Returns the receiver's close item foreground color when the mouse is hover the widget.org.eclipse.swt.graphics.Color
getHoverBackground()
Returns the receiver's background color when mouse is hover the widget.org.eclipse.swt.graphics.Color
getHoverBorderColor()
Returns the receiver's color for the border when the mouse is hover the widgetorg.eclipse.swt.graphics.Color
getHoverForeground()
Returns the receiver's foreground color when mouse is hover the widget.org.eclipse.swt.graphics.Image
getHoverImage()
Returns the receiver's image when the mouse is hover the widget if it has one, or null if it does not.org.eclipse.swt.graphics.Image
getImage()
Returns the receiver's image if it has one, or null if it does not.org.eclipse.swt.graphics.Color
getPushedStateBackground()
Returns the receiver's background color when the widget is "pushed" (selected).org.eclipse.swt.graphics.Color
getPushedStateBorderColor()
Returns the receiver's color for the border when the widget is "pushed" (selected)org.eclipse.swt.graphics.Color
getPushedStateForeground()
Returns the receiver's foreground color when the widget is "pushed" (selected).org.eclipse.swt.graphics.Image
getPushImage()
Returns the receiver's image when the widget is pushed (selected) if it has one, or null if it does not.boolean
getSelection()
Returnstrue
if the receiver is selected, and false otherwise.java.lang.String
getText()
Returns the receiver's text, which will be an empty string if it has never been set.private void
initDefaultColors()
void
removeCloseListener(CloseListener listener)
Removes the listener from the collection of listeners who will be notified when the control is closed by the user.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
setBorderColor(org.eclipse.swt.graphics.Color borderColor)
Sets the receiver's border color to the color specified by the argument, or to the default system color for the control if the argument is null.void
setChipsBackground(org.eclipse.swt.graphics.Color chipsBackground)
Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.void
setCloseButtonBackground(org.eclipse.swt.graphics.Color closeButtonBackground)
Sets the receiver's close button background color to the color specified by the argument, or to the default system color for the control if the argument is null.void
setCloseButtonForeground(org.eclipse.swt.graphics.Color closeButtonForeground)
Sets the receiver's close button foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.void
setCloseButtonHoverBackground(org.eclipse.swt.graphics.Color closeButtonHoverBackground)
Sets the receiver's close button background 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
setCloseButtonHoverForeground(org.eclipse.swt.graphics.Color closeButtonHoverForeground)
Sets the receiver's close button foreground 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
setHoverBackground(org.eclipse.swt.graphics.Color hoverBackground)
Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.void
setHoverBorderColor(org.eclipse.swt.graphics.Color hoverBorderColor)
Sets the receiver's border 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
setHoverForeground(org.eclipse.swt.graphics.Color hoverForeground)
Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.void
setHoverImage(org.eclipse.swt.graphics.Image hoverImage)
Sets the receiver's image to the argument when the mouse is hover the widget, which may be null indicating that no image should be displayed.void
setImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.void
setPushedStateBackground(org.eclipse.swt.graphics.Color pushedStateBackground)
Sets the receiver's background color when the button is "pushed" (=selected) to the color specified by the argument, or to the default system color for the control if the argument is null.void
setPushedStateBorderColor(org.eclipse.swt.graphics.Color pushedStateBorderColor)
Sets the receiver's border color when the button is "pushed" (selected) to the color specified by the argument, or to the default system color for the control if the argument is null.void
setPushedStateForeground(org.eclipse.swt.graphics.Color pushedStateForeground)
Sets the receiver's foreground color when the button is "pushed" (=selected) to the color specified by the argument, or to the default system color for the control if the argument is null.void
setPushImage(org.eclipse.swt.graphics.Image pushImage)
Sets the receiver's image to the argument when the widget is "pushed" (=selected), which may be null indicating that no image should be displayed.void
setSelection(boolean selected)
Sets the selection state of the receiver, if it is of typeCHECK
orPUSH
.void
setText(java.lang.String text)
Sets the receiver's text.-
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, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
-
-
-
Field Detail
-
CLOSE_CIRCLE_RAY
private static final int CLOSE_CIRCLE_RAY
- See Also:
- Constant Field Values
-
hoverForeground
private org.eclipse.swt.graphics.Color hoverForeground
-
hoverBackground
private org.eclipse.swt.graphics.Color hoverBackground
-
closeButtonForeground
private org.eclipse.swt.graphics.Color closeButtonForeground
-
closeButtonBackground
private org.eclipse.swt.graphics.Color closeButtonBackground
-
closeButtonHoverForeground
private org.eclipse.swt.graphics.Color closeButtonHoverForeground
-
closeButtonHoverBackground
private org.eclipse.swt.graphics.Color closeButtonHoverBackground
-
pushedStateForeground
private org.eclipse.swt.graphics.Color pushedStateForeground
-
pushedStateBackground
private org.eclipse.swt.graphics.Color pushedStateBackground
-
borderColor
private org.eclipse.swt.graphics.Color borderColor
-
hoverBorderColor
private org.eclipse.swt.graphics.Color hoverBorderColor
-
pushedStateBorderColor
private org.eclipse.swt.graphics.Color pushedStateBorderColor
-
chipsBackground
private org.eclipse.swt.graphics.Color chipsBackground
-
text
private java.lang.String text
-
image
private org.eclipse.swt.graphics.Image image
-
pushImage
private org.eclipse.swt.graphics.Image pushImage
-
hoverImage
private org.eclipse.swt.graphics.Image hoverImage
-
selection
private boolean selection
-
isCheck
private final boolean isCheck
-
isPush
private final boolean isPush
-
isClose
private final boolean isClose
-
selectionListeners
private final java.util.List<org.eclipse.swt.events.SelectionListener> selectionListeners
-
closeListeners
private final java.util.List<CloseListener> closeListeners
-
cursorInside
private boolean cursorInside
-
closeCenter
private org.eclipse.swt.graphics.Point closeCenter
-
-
Constructor Detail
-
Chips
public Chips(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
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
-
-
Method Detail
-
checkStyle
private static int checkStyle(int style)
-
drawBackground
private int drawBackground(org.eclipse.swt.graphics.GC gc)
-
drawWidgetBorder
private void drawWidgetBorder(org.eclipse.swt.graphics.GC gc)
-
determineBackgroundColor
private org.eclipse.swt.graphics.Color determineBackgroundColor()
-
drawCheck
private int drawCheck(org.eclipse.swt.graphics.GC gc, int x)
-
drawImage
private int drawImage(org.eclipse.swt.graphics.GC gc, int x)
-
drawText
private int drawText(org.eclipse.swt.graphics.GC gc, int x)
-
drawClose
private void drawClose(org.eclipse.swt.graphics.GC gc, int x)
-
initDefaultColors
private void initDefaultColors()
-
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)
-
addCloseListener
public void addCloseListener(CloseListener listener)
Adds the listener to the collection of listeners who will be notified when the control is closed by the user, by sending it one of the messages defined in theCodeListener
interface.widgetDefaultSelected
is not called.- Parameters:
listener
- the listener which should be notified when the control is closed 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:
CloseListener
,removeCloseListener(org.eclipse.nebula.widgets.chips.CloseListener)
,SelectionEvent
-
addListener
public void addListener(int eventType, org.eclipse.swt.widgets.Listener listener)
- Overrides:
addListener
in classorg.eclipse.swt.widgets.Widget
- See Also:
Widget.addListener(int, org.eclipse.swt.widgets.Listener)
-
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
-
removeCloseListener
public void removeCloseListener(CloseListener listener)
Removes the listener from the collection of listeners who will be notified when the control is closed 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:
CloseListener
,addCloseListener(org.eclipse.nebula.widgets.chips.CloseListener)
-
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)
-
getChipsBackground
public org.eclipse.swt.graphics.Color getChipsBackground()
Returns the receiver's background color.- 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
-
getHoverForeground
public org.eclipse.swt.graphics.Color getHoverForeground()
Returns the receiver's foreground color when mouse is hover the widget.Note: This operation is only available if at least one the SWT.CHECK, SWT.PUSH and SWT.CLOSE flag is set.
- 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
-
getHoverBackground
public org.eclipse.swt.graphics.Color getHoverBackground()
Returns the receiver's background color when mouse is hover the widget.Note: This operation is only available if at least one the SWT.CHECK, SWT.PUSH and SWT.CLOSE flag is set.
- 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
-
getCloseButtonForeground
public org.eclipse.swt.graphics.Color getCloseButtonForeground()
Returns the receiver's close item foreground color.Note: This operation is only available if the SWT.CLOSE flag is set.
- 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
-
getCloseButtonBackground
public org.eclipse.swt.graphics.Color getCloseButtonBackground()
Returns the receiver's close item background color.Note: This operation is only available if the SWT.CLOSE flag is set.
- 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
-
getCloseButtonHoverForeground
public org.eclipse.swt.graphics.Color getCloseButtonHoverForeground()
Returns the receiver's close item foreground color when the mouse is hover the widget.Note: This operation is only available if the SWT.CLOSE flag is set.
- 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
-
getCloseButtonHoverBackground
public org.eclipse.swt.graphics.Color getCloseButtonHoverBackground()
Returns the receiver's close item background color when the mouse is hover the widget.Note: This operation is only available if the SWT.CLOSE flag is set.
- 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
-
getPushedStateForeground
public org.eclipse.swt.graphics.Color getPushedStateForeground()
Returns the receiver's foreground color when the widget is "pushed" (selected).Note: This operation is only available if the SWT.PUSH flag is set.
- 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
-
getPushedStateBackground
public org.eclipse.swt.graphics.Color getPushedStateBackground()
Returns the receiver's background color when the widget is "pushed" (selected).Note: This operation is only available if the SWT.PUSH flag is set.
- 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
-
getBorderColor
public org.eclipse.swt.graphics.Color getBorderColor()
Returns the receiver's color for the border of the widget.- Returns:
- the border 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
-
getHoverBorderColor
public org.eclipse.swt.graphics.Color getHoverBorderColor()
Returns the receiver's color for the border when the mouse is hover the widgetNote: This operation is only available if at least one the SWT.CHECK, SWT.PUSH and SWT.CLOSE flag is set.
- Returns:
- the border 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
-
getPushedStateBorderColor
public org.eclipse.swt.graphics.Color getPushedStateBorderColor()
Returns the receiver's color for the border when the widget is "pushed" (selected)Note: This operation is only available if the SWT.PUSH flag is set.
- Returns:
- the border 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
-
getText
public java.lang.String getText()
Returns the receiver's text, which will be an empty string if it has never been set.- Returns:
- the receiver's text
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getImage
public org.eclipse.swt.graphics.Image getImage()
Returns the receiver's image if it has one, or null if it does not.- Returns:
- the receiver's image
- 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
-
getPushImage
public org.eclipse.swt.graphics.Image getPushImage()
Returns the receiver's image when the widget is pushed (selected) if it has one, or null if it does not.Note: This operation is only available if the SWT.PUSH flag is set.
- Returns:
- the receiver's image
- 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
-
getHoverImage
public org.eclipse.swt.graphics.Image getHoverImage()
Returns the receiver's image when the mouse is hover the widget if it has one, or null if it does not.Note: This operation is only available if at least one the SWT.CHECK, SWT.PUSH and SWT.CLOSE flag is set.
- Returns:
- the receiver's image
- 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.Note: This operation is only available if the SWT.CHECK or the SWT.PUSH flag is set.
- 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
-
setChipsBackground
public void setChipsBackground(org.eclipse.swt.graphics.Color chipsBackground)
Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.- 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
-
setHoverForeground
public void setHoverForeground(org.eclipse.swt.graphics.Color hoverForeground)
Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is only available if at least one the SWT.CHECK, SWT.PUSH and SWT.CLOSE flag is set.
- 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
-
setHoverBackground
public void setHoverBackground(org.eclipse.swt.graphics.Color hoverBackground)
Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is only available if at least one the SWT.CHECK, SWT.PUSH and SWT.CLOSE flag is set.
- 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
-
setCloseButtonForeground
public void setCloseButtonForeground(org.eclipse.swt.graphics.Color closeButtonForeground)
Sets the receiver's close button foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is only available if the SWT.CLOSE flag is set.
- 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
-
setCloseButtonBackground
public void setCloseButtonBackground(org.eclipse.swt.graphics.Color closeButtonBackground)
Sets the receiver's close button background color to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is only available if the SWT.CLOSE flag is set.
- 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
-
setCloseButtonHoverForeground
public void setCloseButtonHoverForeground(org.eclipse.swt.graphics.Color closeButtonHoverForeground)
Sets the receiver's close button foreground 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.Note: This operation is only available if the SWT.CLOSE flag is set.
- 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
-
setCloseButtonHoverBackground
public void setCloseButtonHoverBackground(org.eclipse.swt.graphics.Color closeButtonHoverBackground)
Sets the receiver's close button background 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.Note: This operation is only available if the SWT.CLOSE flag is set.
- 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
-
setPushedStateForeground
public void setPushedStateForeground(org.eclipse.swt.graphics.Color pushedStateForeground)
Sets the receiver's foreground color when the button is "pushed" (=selected) to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is only available if the SWT.PUSH flag is set.
- 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
-
setPushedStateBackground
public void setPushedStateBackground(org.eclipse.swt.graphics.Color pushedStateBackground)
Sets the receiver's background color when the button is "pushed" (=selected) to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is only available if the SWT.PUSH flag is set.
- 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
-
setBorderColor
public void setBorderColor(org.eclipse.swt.graphics.Color borderColor)
Sets the receiver's border color 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
-
setHoverBorderColor
public void setHoverBorderColor(org.eclipse.swt.graphics.Color hoverBorderColor)
Sets the receiver's border 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.Note: This operation is only available if at least one the SWT.CHECK, SWT.PUSH and SWT.CLOSE flag is set.
- 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
-
setPushedStateBorderColor
public void setPushedStateBorderColor(org.eclipse.swt.graphics.Color pushedStateBorderColor)
Sets the receiver's border color when the button is "pushed" (selected) to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is a hint and may be overridden by the platform.
- 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
-
setText
public void setText(java.lang.String text)
Sets the receiver's text.This method sets the widget label. The label may include the mnemonic character and line delimiters.
- Parameters:
string
- the new text- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the text 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
-
setImage
public void setImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.- Parameters:
image
- the image to display on the receiver (may be null)- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the image 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
-
setPushImage
public void setPushImage(org.eclipse.swt.graphics.Image pushImage)
Sets the receiver's image to the argument when the widget is "pushed" (=selected), which may be null indicating that no image should be displayed.Note: This operation is only available if the SWT.PUSH flag is set.
- Parameters:
image
- the image to display on the receiver (may be null)- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the image 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
-
setHoverImage
public void setHoverImage(org.eclipse.swt.graphics.Image hoverImage)
Sets the receiver's image to the argument when the mouse is hover the widget, which may be null indicating that no image should be displayed.Note: This operation is only available if at least one the SWT.CHECK, SWT.PUSH and SWT.CLOSE flag is set.
- Parameters:
image
- the image to display on the receiver (may be null)- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the image 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, if it is of typeCHECK
orPUSH
.When the receiver is of type
CHECK
orRADIO
, it is selected when it is checked. When it is of typeTOGGLE
, it is selected when it is pushed in.- 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
-
-