Top Description Fields Constructors Methods
org.eclipse.swt.widgets

public Class Button

extends Control
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.events.*, org.eclipse.swt.graphics.*, org.eclipse.swt.internal.*, org.eclipse.swt.internal.gtk.*, org.eclipse.swt.internal.gtk3.*, org.eclipse.swt.internal.gtk4.*

Instances of this class represent a selectable user interface object that issues notification when pressed and released.
Styles:
ARROW, CHECK, PUSH, RADIO, TOGGLE, FLAT, WRAP
UP, DOWN, LEFT, RIGHT, CENTER
Events:
Selection

Note

Only one of the styles ARROW, CHECK, PUSH, RADIO, and TOGGLE may be specified.

Note

Only one of the styles LEFT, RIGHT, and CENTER may be specified.

Note

Only one of the styles UP, DOWN, LEFT, and RIGHT may be specified when the ARROW style is specified.

Important Note

This class is not intended to be subclassed.

See Also
Button snippets, SWT Example: ControlExample, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv long
pack-priv GdkRGBA
pack-priv long
pack-priv static final int
pack-priv Image
pack-priv boolean
pack-priv boolean
pack-priv long
pack-priv Image
pack-priv long
pack-priv static final int
pack-priv long
pack-priv boolean
pack-priv String
pack-priv boolean
toggleButtonTheming

True iff this toggle button requires special theme handling.

Inherited from org.eclipse.swt.widgets.Control:
accessibleautoScalebackgroundAlphabackgroundImagecachedNoBackgroundcheckScaleFactorcssBackgroundcssForegroundcursorDISABLE_EMOJIdragDetectionQueuedragGesturedrawCountdrawRegionenableWindoweventRegionfirstFixedHandlefixedHandlefontgestureBegingestureEndgestureRotationgestureSwipegestureZoomkeyControllerlabelRelationlastInputlayoutDatamenumouseDownpanGestureparentproviderredrawWindowregionregionHandlerotateGesturetoolTipTextzoomGesture

Constructor Summary

AccessConstructor and Description
public
Button(Composite
a composite control which will be the parent of the new instance (cannot be null)
parent
,
int
the style of control to construct
style
)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
_setAlignment(int alignment)

private void
public void
addSelectionListener(SelectionListener
the listener which should be notified
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.

pack-priv void
pack-priv static int
checkStyle(int style)

pack-priv Point
computeSizeInPixels(int wHint, int hHint, boolean changed)

Overrides org.eclipse.swt.widgets.Control.computeSizeInPixels.

pack-priv void
pack-priv void
pack-priv void
private void
pack-priv long
dpiChanged(long object, long arg0)

Overrides org.eclipse.swt.widgets.Widget.dpiChanged.

pack-priv long
public int

Returns:

the alignment
getAlignment
()

Returns a value which describes the position of the text or image in the receiver.

pack-priv GtkBorder
getBorder(byte[] border, long handle, int defaultBorder)

pack-priv GdkRGBA
public boolean

Returns:

the grayed state of the checkbox
getGrayed
()

Returns true if the receiver is grayed, and false otherwise.

public Image

Returns:

the receiver's image
getImage
()

Returns the receiver's image if it has one, or null if it does not.

pack-priv String
public boolean

Returns:

the selection state
getSelection
()

Returns true if the receiver is selected, and false otherwise.

public String

Returns:

the receiver's text
getText
()

Returns the receiver's text, which will be an empty string if it has never been set or if the receiver is an ARROW button.

pack-priv boolean
gtk4_key_press_event(long
the corresponding controller responsible for capturing the event
controller
,
int
the pressed key
keyval
,
int
raw code of the pressed key
keycode
,
int
the bitmask, representing the state of the modifier keys and pointer buttons
state
,
long
the GdkEvent captured
event
)

Overrides org.eclipse.swt.widgets.Control.gtk4_key_press_event.

pack-priv long
pack-priv long
pack-priv long
gtk_draw(long widget, long cairo)

Overrides org.eclipse.swt.widgets.Control.gtk_draw.

pack-priv long
pack-priv long
pack-priv long
pack-priv void
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
mustBeVisibleOnInitBounds()

Overrides org.eclipse.swt.widgets.Control.mustBeVisibleOnInitBounds.

Widgets with unusual bounds calculation behavior can override this method to return true if the widget must be visible during call to setInitialBounds().
pack-priv void
pack-priv void
pack-priv void
public void
removeSelectionListener(SelectionListener
the listener which should no longer be notified
listener
)

Removes the listener from the collection of listeners who will be notified when the control is selected by the user.

pack-priv void
pack-priv void
public void
setAlignment(int
the new alignment
alignment
)

Controls how text, images and arrows will be displayed in the receiver.

pack-priv void
pack-priv int
setBounds(int x, int y, int width, int height, boolean move, boolean resize)

Overrides org.eclipse.swt.widgets.Control.setBounds.

public void
setEnabled(boolean
the new enabled state
enabled
)

Overrides org.eclipse.swt.widgets.Control.setEnabled.

Enables the receiver if the argument is true, and disables it otherwise.
pack-priv void
pack-priv void
pack-priv void
public void
setGrayed(boolean
the new grayed state
grayed
)

Sets the grayed state of the receiver.

public void
setImage(Image
the image to display on the receiver (may be null)
image
)

Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.

pack-priv void
pack-priv boolean
public void
setSelection(boolean
the new selection state
selected
)

Sets the selection state of the receiver, if it is of type CHECK, RADIO, or TOGGLE.

public void
setText(String
the new text
string
)

Sets the receiver's text.

pack-priv void
pack-priv int
private void
pack-priv long
windowProc(long handle, long arg0, long user_data)

Overrides org.eclipse.swt.widgets.Control.windowProc.

Inherited from org.eclipse.swt.widgets.Control:
_getAccessible_getShelladdControlListeneraddDragDetectListeneraddFocusListeneraddGestureListeneraddHelpListeneraddKeyListeneraddMenuDetectListeneraddMouseListeneraddMouseMoveListeneraddMouseTrackListeneraddMouseWheelListeneraddPaintListeneraddRelationaddTouchListeneraddTraverseListeneradjustChildClippingcairoClipRegioncairoCopyRegioncairoDisposeRegioncheckBordercheckBufferedcheckMirroredcheckSubwindowcleanupEnableWindowcomputeNativeSizecomputeSizecomputeSizecomputeSizeInPixelscomputeTabGroupcomputeTabListcomputeTabRootcontainedInRegiondefaultBackgrounddefaultFontdestroyWidgetdragDetectdragDetectdragDetectdragDetectdrawBackgrounddrawGripperdrawWidgetenableWidgetenterExitHandleeventHandleeventSurfaceeventWindowfilterKeyfindBackgroundControlfindMenusfixChildrenfixFocusfixGdkEventTypeValuesfixModalfixParentGdkResourcefixStylefixStyleflushQueueOnDndfocusHandleforceFocusforceFocusforceResizegestureBeginProcgestureEndProcgestureHandlegetAccessiblegetBackgroundgetBackgroundGdkRGBAgetBackgroundImagegetBaseGdkRGBAgetBgGdkRGBAgetBorderWidthgetBorderWidthInPixelsgetBoundsgetBoundsInPixelsgetClientWidthgetContextColorGdkRGBAgetControlgetControlOrigingetCursorgetDragDetectgetEnabledgetFontgetFontDescriptiongetForegroundgetForegroundGdkRGBAgetIMCaretPosgetLayoutDatagetLocationgetLocationInPixelsgetMenugetMonitorgetOrientationgetParentgetPathgetRegiongetShellgetSizegetSizeInPixelsgetSurfaceOrigingetTextDirectiongetThicknessgetToolTipTextgetTouchEnabledgetVisiblegetWindowOrigingtk3_show_helpgtk4_drawgtk4_enter_eventgtk4_focus_enter_eventgtk4_focus_leave_eventgtk4_focus_window_eventgtk4_key_release_eventgtk4_leave_eventgtk4_motion_eventgtk4_scroll_eventgtk_button_press_eventgtk_button_release_eventgtk_commitgtk_css_provider_load_from_cssgtk_enter_notify_eventgtk_event_aftergtk_focusgtk_gesture_press_eventgtk_gesture_release_eventgtk_key_release_eventgtk_label_set_aligngtk_leave_notify_eventgtk_mnemonic_activategtk_motion_notify_eventgtk_popup_menugtk_preedit_changedgtk_realizegtk_scroll_eventgtk_style_context_get_bordergtk_style_context_get_paddinggtk_style_updatedgtk_unrealizegtk_widget_reparentgtk_widget_set_alignhasFocushooksPainthoverProcimHandleinternal_dispose_GCinternal_new_GCisActiveisAutoScalableisEnabledisFocusAncestorisFocusControlisFocusHandleisReparentableisShowingisTabGroupisTabItemisVisiblemagnifyProcmarkLayoutmenuShellmoveAbovemoveBelowmoveChildrenmoveHandlepackpackpaintHandlepaintSurfacepaintWindowprintprintWidgetprintWindowredrawredrawredrawredrawChildrenredrawInPixelsredrawWidgetreleasereleaseParentremoveControlListenerremoveDragDetectListenerremoveFocusListenerremoveGestureListenerremoveHelpListenerremoveKeyListenerremoveMenuDetectListenerremoveMouseListenerremoveMouseMoveListenerremoveMouseTrackListenerremoveMouseWheelListenerremovePaintListenerremoveRelationremoveTouchListenerremoveTraverseListenerrequestLayoutresizeCalculationsGTK3restackWindowrotateProcsendDragEventsendFocusEventsendGestureEventsendGestureEventsendGestureEventsendHelpEventsendLeaveNotifysendMouseEventsendMouseEventsetBackgroundsetBackgroundsetBackgroundGdkRGBAsetBackgroundGdkRGBAsetBackgroundImagesetBackgroundSurfacesetBoundssetBoundssetBoundsInPixelssetBoundsInPixelssetCapturesetCursorsetCursorsetDragDetectsetFocussetFontsetForegroundsetInitialBoundssetLayoutDatasetLocationsetLocationsetLocationInPixelssetLocationInPixelssetMenusetOrientationsetParentsetParentBackgroundsetParentGdkResourcesetRedrawsetRegionsetRelationssetSizesetSizesetSizeInPixelssetSizeInPixelssetTabItemFocussetTextDirectionsetToolTipTextsetToolTipTextsetTouchEnabledsetVisiblesetWidgetBackgroundsetZOrdersetZOrdershowMenushowMenusortswipeProctoControltoControltoDisplaytoDisplaytoDisplayInPixelstoDisplayInPixelstopHandletranslateMnemonictranslateMnemonictranslateTraversaltraversetraversetraversetraversetraversetraverseEscapetraverseGrouptraverseItemtraverseMnemonictraversePagetraverseReturnupdateupdateupdateBackgroundModeupdateLayoutwantDragDropDetection

Field Detail

arrowHandleback to summary
pack-priv long arrowHandle
backgroundback to summary
pack-priv GdkRGBA background
boxHandleback to summary
pack-priv long boxHandle
DEFAULT_BORDERback to summary
pack-priv static final int DEFAULT_BORDER
defaultDisableImageback to summary
pack-priv Image defaultDisableImage
enabledback to summary
pack-priv boolean enabled
grayedback to summary
pack-priv boolean grayed
groupHandleback to summary
pack-priv long groupHandle
imageback to summary
pack-priv Image image
imageHandleback to summary
pack-priv long imageHandle
INNER_BORDERback to summary
pack-priv static final int INNER_BORDER
labelHandleback to summary
pack-priv long labelHandle
selectedback to summary
pack-priv boolean selected
textback to summary
pack-priv String text
toggleButtonThemingback to summary
pack-priv boolean toggleButtonTheming

True iff this toggle button requires special theme handling. See bug 546552.

Constructor Detail

Buttonback to summary
public Button(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:Composite

a composite control which will be the parent of the new instance (cannot be null)

style:int

the style of control to construct

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the parent is null
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
See Also
SWT#ARROW, SWT#CHECK, SWT#PUSH, SWT#RADIO, SWT#TOGGLE, SWT#FLAT, SWT#UP, SWT#DOWN, SWT#LEFT, SWT#RIGHT, SWT#CENTER, Widget#checkSubclass, Widget#getStyle

Method Detail

_setAlignmentback to summary
pack-priv void _setAlignment(int alignment)
_setImageback to summary
private void _setImage(Image image)
addSelectionListenerback to summary
public void addSelectionListener(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.

When the SWT.RADIO style bit is set, the widgetSelected method is also called when the receiver loses selection because another item in the same radio group was selected by the user. During widgetSelected the application can use getSelection() to determine the current selected state of the receiver.

Parameters
listener:SelectionListener

the listener which should be notified

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the listener is null
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, SelectionEvent
checkBackgroundback to summary
pack-priv void checkBackground()

Overrides org.eclipse.swt.widgets.Control.checkBackground.

Annotations
@Override
checkStyleback to summary
pack-priv static int checkStyle(int style)
computeSizeInPixelsback to summary
pack-priv Point computeSizeInPixels(int wHint, int hHint, boolean changed)

Overrides org.eclipse.swt.widgets.Control.computeSizeInPixels.

Annotations
@Override
createHandleback to summary
pack-priv void createHandle(int index)

Overrides org.eclipse.swt.widgets.Widget.createHandle.

Annotations
@Override
createWidgetback to summary
pack-priv void createWidget(int index)

Overrides org.eclipse.swt.widgets.Control.createWidget.

Annotations
@Override
deregisterback to summary
pack-priv void deregister()

Overrides org.eclipse.swt.widgets.Control.deregister.

Annotations
@Override
disposeDefaultDisabledImageback to summary
private void disposeDefaultDisabledImage()
dpiChangedback to summary
pack-priv long dpiChanged(long object, long arg0)

Overrides org.eclipse.swt.widgets.Widget.dpiChanged.

Annotations
@Override
fontHandleback to summary
pack-priv long fontHandle()

Overrides org.eclipse.swt.widgets.Control.fontHandle.

Annotations
@Override
getAlignmentback to summary
public int getAlignment()

Returns a value which describes the position of the text or image in the receiver. The value will be one of LEFT, RIGHT or CENTER unless the receiver is an ARROW button, in which case, the alignment will indicate the direction of the arrow (one of LEFT, RIGHT, UP or DOWN).

Returns:int

the alignment

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getBorderback to summary
pack-priv GtkBorder getBorder(byte[] border, long handle, int defaultBorder)
getContextBackgroundGdkRGBAback to summary
pack-priv GdkRGBA getContextBackgroundGdkRGBA()

Overrides org.eclipse.swt.widgets.Control.getContextBackgroundGdkRGBA.

Annotations
@Override
getGrayedback to summary
public boolean getGrayed()

Returns true if the receiver is grayed, and false otherwise. When the widget does not have the CHECK style, return false.

Returns:boolean

the grayed state of the checkbox

Exceptions
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
getImageback to summary
public Image getImage()

Returns the receiver's image if it has one, or null if it does not.

Returns:Image

the receiver's image

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getNameTextback to summary
pack-priv String getNameText()

Overrides org.eclipse.swt.widgets.Widget.getNameText.

Annotations
@Override
getSelectionback to summary
public boolean getSelection()

Returns true if the receiver is selected, and false otherwise.

When the receiver is of type CHECK or RADIO, it is selected when it is checked. When it is of type TOGGLE, it is selected when it is pushed in. If the receiver is of any other type, this method returns false.

Returns:boolean

the selection state

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getTextback to summary
public String getText()

Returns the receiver's text, which will be an empty string if it has never been set or if the receiver is an ARROW button.

Returns:String

the receiver's text

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
gtk4_key_press_eventback to summary
pack-priv boolean gtk4_key_press_event(long controller, int keyval, int keycode, int state, long event)

Overrides org.eclipse.swt.widgets.Control.gtk4_key_press_event.

Parameters
controller:long

Doc from org.eclipse.swt.widgets.Widget.gtk4_key_press_event.

the corresponding controller responsible for capturing the event

keyval:int

Doc from org.eclipse.swt.widgets.Widget.gtk4_key_press_event.

the pressed key

keycode:int

Doc from org.eclipse.swt.widgets.Widget.gtk4_key_press_event.

raw code of the pressed key

state:int

Doc from org.eclipse.swt.widgets.Widget.gtk4_key_press_event.

the bitmask, representing the state of the modifier keys and pointer buttons

event:long

Doc from org.eclipse.swt.widgets.Widget.gtk4_key_press_event.

the GdkEvent captured

Returns:boolean

Doc from org.eclipse.swt.widgets.Widget.gtk4_key_press_event.

TRUE if the event has been fully/properly handled, otherwise FALSE

Annotations
@Override
gtk_button_press_eventback to summary
pack-priv long gtk_button_press_event(long widget, long event)

Overrides org.eclipse.swt.widgets.Control.gtk_button_press_event.

Annotations
@Override
gtk_clickedback to summary
pack-priv long gtk_clicked(long widget)

Overrides org.eclipse.swt.widgets.Widget.gtk_clicked.

Annotations
@Override
gtk_drawback to summary
pack-priv long gtk_draw(long widget, long cairo)

Overrides org.eclipse.swt.widgets.Control.gtk_draw.

Annotations
@Override
gtk_focus_in_eventback to summary
pack-priv long gtk_focus_in_event(long widget, long event)

Overrides org.eclipse.swt.widgets.Control.gtk_focus_in_event.

Annotations
@Override
gtk_focus_out_eventback to summary
pack-priv long gtk_focus_out_event(long widget, long event)

Overrides org.eclipse.swt.widgets.Control.gtk_focus_out_event.

Annotations
@Override
gtk_key_press_eventback to summary
pack-priv long gtk_key_press_event(long widget, long event)

Overrides org.eclipse.swt.widgets.Control.gtk_key_press_event.

Annotations
@Override
hookEventsback to summary
pack-priv void hookEvents()

Overrides org.eclipse.swt.widgets.Control.hookEvents.

Annotations
@Override
isDescribedByLabelback to summary
pack-priv boolean isDescribedByLabel()

Overrides org.eclipse.swt.widgets.Control.isDescribedByLabel.

Annotations
@Override
mnemonicHitback to summary
pack-priv boolean mnemonicHit(char key)

Overrides org.eclipse.swt.widgets.Control.mnemonicHit.

Annotations
@Override
mnemonicMatchback to summary
pack-priv boolean mnemonicMatch(char key)

Overrides org.eclipse.swt.widgets.Control.mnemonicMatch.

Annotations
@Override
mustBeVisibleOnInitBoundsback to summary
pack-priv boolean mustBeVisibleOnInitBounds()

Overrides org.eclipse.swt.widgets.Control.mustBeVisibleOnInitBounds.

Doc from org.eclipse.swt.widgets.Control.mustBeVisibleOnInitBounds.

Widgets with unusual bounds calculation behavior can override this method to return true if the widget must be visible during call to setInitialBounds().

Returns:boolean

false by default on modern GTK 3 versions (3.20+).

Annotations
@Override
registerback to summary
pack-priv void register()

Overrides org.eclipse.swt.widgets.Control.register.

Annotations
@Override
releaseHandleback to summary
pack-priv void releaseHandle()

Overrides org.eclipse.swt.widgets.Control.releaseHandle.

Annotations
@Override
releaseWidgetback to summary
pack-priv void releaseWidget()

Overrides org.eclipse.swt.widgets.Control.releaseWidget.

Annotations
@Override
removeSelectionListenerback to summary
public void removeSelectionListener(SelectionListener listener)

Removes the listener from the collection of listeners who will be notified when the control is selected by the user.

Parameters
listener:SelectionListener

the listener which should no longer be notified

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the listener is null
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
resizeHandleback to summary
pack-priv void resizeHandle(int width, int height)

Overrides org.eclipse.swt.widgets.Control.resizeHandle.

Annotations
@Override
selectRadioback to summary
pack-priv void selectRadio()
setAlignmentback to summary
public void setAlignment(int alignment)

Controls how text, images and arrows will be displayed in the receiver. The argument should be one of LEFT, RIGHT or CENTER unless the receiver is an ARROW button, in which case, the argument indicates the direction of the arrow (one of LEFT, RIGHT, UP or DOWN).

Parameters
alignment:int

the new alignment

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setBackgroundGdkRGBAback to summary
pack-priv void setBackgroundGdkRGBA(long context, long handle, GdkRGBA rgba)

Overrides org.eclipse.swt.widgets.Control.setBackgroundGdkRGBA.

Annotations
@Override
setBoundsback to summary
pack-priv int setBounds(int x, int y, int width, int height, boolean move, boolean resize)

Overrides org.eclipse.swt.widgets.Control.setBounds.

Annotations
@Override
setEnabledback to summary
public void setEnabled(boolean enabled)

Overrides org.eclipse.swt.widgets.Control.setEnabled.

Enables the receiver if the argument is true, and disables it otherwise.

A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.

Parameters
enabled:boolean

the new enabled state

Annotations
@Override
Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setFontDescriptionback to summary
pack-priv void setFontDescription(long fontDesc)

Overrides org.eclipse.swt.widgets.Control.setFontDescription.

Annotations
@Override
setForegroundGdkRGBAback to summary
pack-priv void setForegroundGdkRGBA(GdkRGBA rgba)

Overrides org.eclipse.swt.widgets.Control.setForegroundGdkRGBA.

Annotations
@Override
setForegroundGdkRGBAback to summary
pack-priv void setForegroundGdkRGBA(long handle, GdkRGBA rgba)

Overrides org.eclipse.swt.widgets.Control.setForegroundGdkRGBA.

Annotations
@Override
setGrayedback to summary
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:boolean

the new grayed state

Exceptions
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
setImageback to summary
public void setImage(Image image)

Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.

Note that a Button can display an image and text simultaneously.

Parameters
image:Image

the image to display on the receiver (may be null)

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the image has been disposed
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setOrientationback to summary
pack-priv void setOrientation(boolean create)

Overrides org.eclipse.swt.widgets.Control.setOrientation.

Annotations
@Override
setRadioSelectionback to summary
pack-priv boolean setRadioSelection(boolean value)

Overrides org.eclipse.swt.widgets.Control.setRadioSelection.

Annotations
@Override
setSelectionback to summary
public void setSelection(boolean selected)

Sets the selection state of the receiver, if it is of type CHECK, RADIO, or TOGGLE.

When the receiver is of type CHECK or RADIO, it is selected when it is checked. When it is of type TOGGLE, it is selected when it is pushed in.

Parameters
selected:boolean

the new selection state

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setTextback to summary
public void setText(String string)

Sets the receiver's text.

This method sets the button label. The label may include the mnemonic character but must not contain line delimiters.

Mnemonics are indicated by an '&' that causes the next character to be the mnemonic. When the user presses a key sequence that matches the mnemonic, a selection event occurs. On most platforms, the mnemonic appears underlined but may be emphasized in a platform specific manner. The mnemonic indicator character '&' can be escaped by doubling it in the string, causing a single '&' to be displayed.

Note that a Button can display an image and text simultaneously on Windows (starting with XP), GTK+ and OSX. On other platforms, a Button that has an image and text set into it will display the image or text that was set most recently.

Also note, if control characters like '\n', '\t' etc. are used in the string, then the behavior is platform dependent.

Parameters
string:String

the new text

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the text is null
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
showWidgetback to summary
pack-priv void showWidget()

Overrides org.eclipse.swt.widgets.Control.showWidget.

Annotations
@Override
traversalCodeback to summary
pack-priv int traversalCode(int key, long event)

Overrides org.eclipse.swt.widgets.Control.traversalCode.

Annotations
@Override
updateWidgetsVisibilityback to summary
private void updateWidgetsVisibility()
windowProcback to summary
pack-priv long windowProc(long handle, long arg0, long user_data)

Overrides org.eclipse.swt.widgets.Control.windowProc.

Annotations
@Override