Class Button
- All Implemented Interfaces:
Drawable
- 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: This class is not intended to be subclassed.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) long(package private) GdkRGBA(package private) long(package private) static final int(package private) Image(package private) boolean(package private) boolean(package private) long(package private) Image(package private) long(package private) static final int(package private) long(package private) boolean(package private) String(package private) booleanTrue iff this toggle button requires special theme handling.Fields inherited from class Control
accessible, autoScale, backgroundAlpha, backgroundImage, cachedNoBackground, checkScaleFactor, cssBackground, cssForeground, cursor, DISABLE_EMOJI, dragDetectionQueue, dragGesture, drawCount, drawRegion, enableWindow, eventRegion, firstFixedHandle, fixedHandle, font, gestureBegin, gestureEnd, gestureRotation, gestureSwipe, gestureZoom, keyController, labelRelation, lastInput, layoutData, menu, mouseDown, panGesture, parent, provider, redrawWindow, region, regionHandle, rotateGesture, toolTipText, zoomGestureFields inherited from class Widget
ACTIVATE, ACTIVATE_INVERSE, AUTO_TEXT_DIRECTION, BACKGROUND, BACKSPACE, BACKSPACE_INVERSE, BUTTON_PRESS_EVENT, BUTTON_PRESS_EVENT_INVERSE, BUTTON_RELEASE_EVENT, BUTTON_RELEASE_EVENT_INVERSE, CANVAS, CHANGE_VALUE, CHANGED, CHECK_SUBWINDOW, CLICKED, CLOSE_REQUEST, COMMIT, COMPUTE_SIZE, CONFIGURE_EVENT, COPY_CLIPBOARD, COPY_CLIPBOARD_INVERSE, CREATE_MENU_PROXY, CUT_CLIPBOARD, CUT_CLIPBOARD_INVERSE, data, DAY_SELECTED, DAY_SELECTED_DOUBLE_CLICK, DECELERATE, DEFAULT_HEIGHT, DEFAULT_WIDTH, DELETE_EVENT, DELETE_FROM_CURSOR, DELETE_FROM_CURSOR_INVERSE, DELETE_RANGE, DELETE_TEXT, DIRECTION_CHANGED, DISABLED, display, DISPOSE_SENT, DISPOSED, DPI_CHANGED, DRAG_DETECT, DRAW, ENTER, ENTER_NOTIFY_EVENT, EVENT, EVENT_AFTER, eventTable, EXPAND_COLLAPSE_CURSOR_ROW, EXPOSE_EVENT, EXPOSE_EVENT_INVERSE, FOCUS, FOCUS_IN, FOCUS_IN_EVENT, FOCUS_OUT, FOCUS_OUT_EVENT, FONT, FOREGROUND, FOREIGN_HANDLE, gdkSeatGrabPrepareFunc, GESTURE_PRESSED, GESTURE_RELEASED, GRAB_FOCUS, handle, HANDLE, HAS_AUTO_DIRECTION, HIDDEN, HIDE, ICON_RELEASE, IM_UPDATE, INPUT, INSERT_TEXT, IS_ACTIVE, KEY_CHECK_SUBWINDOW, KEY_GTK_CSS, KEY_PRESS_EVENT, KEY_PRESSED, KEY_RELEASE_EVENT, KEY_RELEASED, KEYED_DATA, LAST_SIGNAL, LAYOUT_CHANGED, LAYOUT_CHILD, LAYOUT_NEEDED, LEAVE, LEAVE_NOTIFY_EVENT, MAP, MAP_EVENT, MENU, MNEMONIC_ACTIVATE, MONTH_CHANGED, MOTION, MOTION_INVERSE, MOTION_NOTIFY_EVENT, MOTION_NOTIFY_EVENT_INVERSE, MOVE_CURSOR, MOVE_CURSOR_INVERSE, MOVE_FOCUS, MOVED, NOTIFY_DEFAULT_HEIGHT, NOTIFY_DEFAULT_WIDTH, NOTIFY_MAXIMIZED, NOTIFY_STATE, OBSCURED, OUTPUT, PARENT_BACKGROUND, PASTE_CLIPBOARD, PASTE_CLIPBOARD_INVERSE, POPPED_UP, POPULATE_POPUP, POPUP_MENU, PREEDIT_CHANGED, REALIZE, RELEASED, RESIZED, ROW_ACTIVATED, ROW_DELETED, ROW_HAS_CHILD_TOGGLED, ROW_INSERTED, SCROLL, SCROLL_BEGIN, SCROLL_CHILD, SCROLL_END, SCROLL_EVENT, SELECT, SELECTION_DONE, SHOW, SHOW_HELP, SIZE_ALLOCATE, SIZE_ALLOCATE_GTK4, SKIN_NEEDED, START_INTERACTIVE_SEARCH, state, STATUS_ICON_POPUP_MENU, style, STYLE_UPDATED, SWITCH_PAGE, TEST_COLLAPSE_ROW, TEST_EXPAND_ROW, TEXT_BUFFER_INSERT_TEXT, THEME_BACKGROUND, TOGGLED, UNMAP, UNMAP_EVENT, UNREALIZE, VALUE_CHANGED, WINDOW_STATE_EVENT, ZERO_HEIGHT, ZERO_WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void_setAlignment(int alignment) private voidvoidaddSelectionListener(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 theSelectionListenerinterface.(package private) void(package private) static intcheckStyle(int style) (package private) PointcomputeSizeInPixels(int wHint, int hHint, boolean changed) (package private) voidcreateHandle(int index) (package private) voidcreateWidget(int index) (package private) voidprivate void(package private) longdpiChanged(long object, long arg0) (package private) longintReturns a value which describes the position of the text or image in the receiver.(package private) GtkBordergetBorder(byte[] border, long handle, int defaultBorder) (package private) GdkRGBAbooleanReturnstrueif the receiver is grayed, and false otherwise.getImage()Returns the receiver's image if it has one, or null if it does not.(package private) StringbooleanReturnstrueif the receiver is selected, and false otherwise.getText()Returns the receiver's text, which will be an empty string if it has never been set or if the receiver is anARROWbutton.(package private) longgtk_button_press_event(long widget, long event) (package private) longgtk_clicked(long widget) (package private) longgtk_draw(long widget, long cairo) (package private) longgtk_focus_in_event(long widget, long event) (package private) longgtk_focus_out_event(long widget, long event) (package private) longgtk3_key_press_event(long widget, long event) (package private) booleangtk4_key_press_event(long controller, int keyval, int keycode, int state, long event) (package private) void(package private) boolean(package private) booleanmnemonicHit(char key) (package private) booleanmnemonicMatch(char key) (package private) booleanWidgets with unusual bounds calculation behavior can override this method to returntrueif the widget must be visible during call toControl.setInitialBounds().(package private) voidregister()(package private) void(package private) voidvoidremoveSelectionListener(SelectionListener listener) Removes the listener from the collection of listeners who will be notified when the control is selected by the user.(package private) voidresizeHandle(int width, int height) (package private) voidvoidsetAlignment(int alignment) Controls how text, images and arrows will be displayed in the receiver.(package private) voidsetBackgroundGdkRGBA(long context, long handle, GdkRGBA rgba) (package private) intsetBounds(int x, int y, int width, int height, boolean move, boolean resize) voidsetEnabled(boolean enabled) Enables the receiver if the argument istrue, and disables it otherwise.(package private) voidsetFontDescription(long fontDesc) (package private) voidsetForegroundGdkRGBA(long handle, GdkRGBA rgba) (package private) voidsetForegroundGdkRGBA(GdkRGBA rgba) voidsetGrayed(boolean grayed) Sets the grayed state of the receiver.voidSets the receiver's image to the argument, which may benullindicating that no image should be displayed.(package private) voidsetOrientation(boolean create) (package private) booleansetRadioSelection(boolean value) voidsetSelection(boolean selected) Sets the selection state of the receiver, if it is of typeCHECK,RADIO, orTOGGLE.voidSets the receiver's text.(package private) void(package private) inttraversalCode(int key, long event) private void(package private) longwindowProc(long handle, long arg0, long user_data) Methods inherited from class Control
_getAccessible, _getShell, addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addRelation, addTouchListener, addTraverseListener, adjustChildClipping, cairoClipRegion, cairoCopyRegion, cairoDisposeRegion, checkBorder, checkBuffered, checkMirrored, checkSubwindow, cleanupEnableWindow, computeNativeSize, computeSize, computeSize, computeSizeInPixels, computeTabGroup, computeTabList, computeTabRoot, containedInRegion, defaultBackground, defaultFont, destroyWidget, dragDetect, dragDetect, dragDetect, dragDetect, drawBackground, drawGripper, drawWidget, enableWidget, enterExitHandle, eventHandle, eventSurface, eventWindow, filterKey, findBackgroundControl, findMenus, fixChildren, fixFocus, fixGdkEventTypeValues, fixModal, fixParentGdkResource, fixStyle, fixStyle, flushQueueOnDnd, focusHandle, forceFocus, forceFocus, forceResize, gestureBeginProc, gestureEndProc, gestureHandle, getAccessible, getBackground, getBackgroundGdkRGBA, getBackgroundImage, getBaseGdkRGBA, getBgGdkRGBA, getBorderWidth, getBorderWidthInPixels, getBounds, getBoundsInPixels, getClientWidth, getContextColorGdkRGBA, getControl, getControlOrigin, getCursor, getDragDetect, getEnabled, getFont, getFontDescription, getForeground, getForegroundGdkRGBA, getIMCaretPos, getLayoutData, getLocation, getLocationInPixels, getMenu, getMonitor, getOrientation, getParent, getPath, getRegion, getShell, getSize, getSizeInPixels, getSurfaceOrigin, getTextDirection, getThickness, getToolTipText, getTouchEnabled, getVisible, getWindowOrigin, gtk_button_press_event, gtk_button_release_event, gtk_commit, gtk_css_provider_load_from_css, gtk_enter_notify_event, gtk_focus, gtk_gesture_press_event, gtk_gesture_release_event, gtk_label_set_align, gtk_leave_notify_event, gtk_mnemonic_activate, gtk_motion_notify_event, gtk_preedit_changed, gtk_realize, gtk_scroll_event, gtk_style_context_get_border, gtk_style_context_get_padding, gtk_style_updated, gtk_unrealize, gtk_widget_reparent, gtk_widget_set_align, gtk3_event_after, gtk3_key_release_event, gtk3_popup_menu, gtk3_show_help, gtk4_draw, gtk4_enter_event, gtk4_focus_enter_event, gtk4_focus_leave_event, gtk4_focus_window_event, gtk4_key_release_event, gtk4_leave_event, gtk4_motion_event, gtk4_scroll_event, hasFocus, hooksPaint, hoverProc, imHandle, internal_dispose_GC, internal_new_GC, isActive, isAutoScalable, isEnabled, isFocusAncestor, isFocusControl, isFocusHandle, isReparentable, isShowing, isTabGroup, isTabItem, isVisible, magnifyProc, markLayout, menuShell, moveAbove, moveBelow, moveChildren, moveHandle, pack, pack, paintHandle, paintSurface, paintWindow, print, printWidget, printWindow, redraw, redraw, redraw, redrawChildren, redrawWidget, release, releaseParent, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeRelation, removeTouchListener, removeTraverseListener, requestLayout, resizeCalculationsGTK3, restackWindow, rotateProc, sendDragEvent, sendFocusEvent, sendGestureEvent, sendGestureEvent, sendGestureEvent, sendHelpEvent, sendLeaveNotify, sendMouseEvent, sendMouseEvent, setBackground, setBackground, setBackgroundGdkRGBA, setBackgroundGdkRGBA, setBackgroundImage, setBackgroundSurface, setBounds, setBounds, setBoundsInPixels, setBoundsInPixels, setCapture, setCursor, setCursor, setDragDetect, setFocus, setFont, setForeground, setInitialBounds, setLayoutData, setLocation, setLocation, setLocationInPixels, setLocationInPixels, setMenu, setOrientation, setParent, setParentBackground, setParentGdkResource, setRedraw, setRegion, setRelations, setSize, setSize, setSizeInPixels, setSizeInPixels, setTabItemFocus, setTextDirection, setToolTipText, setToolTipText, setTouchEnabled, setVisible, setWidgetBackground, setZOrder, setZOrder, showMenu, showMenu, sort, swipeProc, toControl, toControl, toDisplay, toDisplay, toDisplayInPixels, topHandle, translateMnemonic, translateMnemonic, translateTraversal, traverse, traverse, traverse, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, update, update, updateBackgroundMode, updateLayout, wantDragDropDetectionMethods inherited from class Widget
_addListener, addDisposeListener, addListener, addTypedListener, cellDataProc, checkBits, checkOpen, checkOrientation, checkParent, checkSubclass, checkWidget, convertPangoFontDescriptionToCss, cssHandle, dispose, enterMotionProc, error, filterProc, filters, fixMnemonic, fixMnemonic, fixMnemonic, focusProc, fontHeight, gdk_event_free, gdk_event_get_state, gdk_event_get_surface_or_window, gdk_pointer_grab, gdk_pointer_ungrab, gdk_surface_get_size, gdk_window_get_size, GdkSeatGrabPrepareFunc, gesturePressReleaseProc, getData, getData, getDisplay, getListeners, getName, getStyle, getTypedListeners, gtk_activate, gtk_adjustment_get, gtk_box_new, gtk_box_pack_end, gtk_box_set_child_packing, gtk_cell_renderer_get_preferred_size, gtk_change_value, gtk_changed, gtk_close_request, gtk_configure_event, gtk_container_get_border_width_or_margin, gtk_container_set_border_width, gtk_create_menu_proxy, gtk_day_selected, gtk_day_selected_double_click, gtk_delete_event, gtk_delete_range, gtk_delete_text, gtk_expand_collapse_cursor_row, gtk_grab_focus, gtk_hide, gtk_icon_release, gtk_input, gtk_insert_text, gtk_map, gtk_map_event, gtk_menu_popped_up, gtk_month_changed, gtk_move_focus, gtk_output, gtk_populate_popup, gtk_row_activated, gtk_row_has_child_toggled, gtk_scroll_child, gtk_select, gtk_selection_done, gtk_show, gtk_size_allocate, gtk_start_interactive_search, gtk_status_icon_popup_menu, gtk_switch_page, gtk_test_collapse_row, gtk_test_expand_row, gtk_text_buffer_insert_text, gtk_timer, gtk_toggled, gtk_tree_view_column_cell_get_position, gtk_unmap, gtk_unmap_event, gtk_value_changed, gtk_widget_get_preferred_size, gtk_widget_get_surface, gtk_widget_get_window, gtk_widget_hide, gtk_widget_show, gtk_widget_size_allocate, gtk_window_state_event, hooks, isAutoDirection, isDisposed, isListening, isValidSubclass, isValidThread, keyPressReleaseProc, leaveProc, mnemonicHit, mnemonicMatch, notifyCreationTracker, notifyDisposalTracker, notifyListeners, notifyProc, notifyState, postEvent, postEvent, releaseChildren, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, rendererGetPreferredWidthProc, rendererRenderProc, rendererSnapshotProc, reskin, reskinChildren, reskinWidget, scrollProc, sendEvent, sendEvent, sendEvent, sendEvent, sendIMKeyEvent, sendKeyEvent, sendSelectionEvent, sendSelectionEvent, setButtonState, setData, setData, setFontDescription, setInputState, setKeyState, setLocationState, setTabGroupFocus, setToolTipText, shellMapProc, sizeAllocateProc, sizeRequestProc, snapshotToDraw, timerProc, toString, translateTraversal, windowActiveProc, windowProc, windowProc, windowProc, windowProc
-
Field Details
-
boxHandle
long boxHandle -
labelHandle
long labelHandle -
imageHandle
long imageHandle -
arrowHandle
long arrowHandle -
groupHandle
long groupHandle -
selected
boolean selected -
grayed
boolean grayed -
toggleButtonTheming
boolean toggleButtonThemingTrue iff this toggle button requires special theme handling. See bug 546552. -
image
Image image -
text
String text -
background
GdkRGBA background -
defaultDisableImage
Image defaultDisableImage -
enabled
boolean enabled -
INNER_BORDER
static final int INNER_BORDER- See Also:
-
DEFAULT_BORDER
static final int DEFAULT_BORDER- See Also:
-
-
Constructor Details
-
Button
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
SWTwhich 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 thoseSWTstyle 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:
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:
-
-
Method Details
-
checkStyle
static int checkStyle(int style) -
getBorder
-
getContextBackgroundGdkRGBA
GdkRGBA getContextBackgroundGdkRGBA()- Overrides:
getContextBackgroundGdkRGBAin classControl
-
addSelectionListener
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 theSelectionListenerinterface.widgetSelectedis called when the control is selected by the user.widgetDefaultSelectedis not called.When the
SWT.RADIOstyle bit is set, thewidgetSelectedmethod is also called when the receiver loses selection because another item in the same radio group was selected by the user. DuringwidgetSelectedthe application can usegetSelection()to determine the current selected state of the receiver.- Parameters:
listener- the listener which should be notified- Throws:
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:
-
computeSizeInPixels
- Overrides:
computeSizeInPixelsin classControl
-
createHandle
void createHandle(int index) - Overrides:
createHandlein classWidget
-
createWidget
void createWidget(int index) - Overrides:
createWidgetin classControl
-
checkBackground
void checkBackground()- Overrides:
checkBackgroundin classControl
-
deregister
void deregister()- Overrides:
deregisterin classControl
-
fontHandle
long fontHandle()- Overrides:
fontHandlein classControl
-
getAlignment
public int getAlignment()Returns a value which describes the position of the text or image in the receiver. The value will be one ofLEFT,RIGHTorCENTERunless the receiver is anARROWbutton, in which case, the alignment will indicate the direction of the arrow (one ofLEFT,RIGHT,UPorDOWN).- Returns:
- the alignment
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getGrayed
public boolean getGrayed()Returnstrueif the receiver is grayed, and false otherwise. When the widget does not have theCHECKstyle, return false.- Returns:
- the grayed state of the checkbox
- Throws:
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
-
getImage
Returns the receiver's image if it has one, or null if it does not.- Returns:
- the receiver's image
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getNameText
String getNameText()- Overrides:
getNameTextin classWidget
-
getSelection
public boolean getSelection()Returnstrueif the receiver is selected, and false otherwise.When the receiver is of type
CHECKorRADIO, it is selected when it is checked. When it is of typeTOGGLE, it is selected when it is pushed in. If the receiver is of any other type, this method returns false.- Returns:
- the selection state
- Throws:
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
Returns the receiver's text, which will be an empty string if it has never been set or if the receiver is anARROWbutton.- Returns:
- the receiver's text
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
gtk_button_press_event
long gtk_button_press_event(long widget, long event) - Overrides:
gtk_button_press_eventin classControl
-
gtk_clicked
long gtk_clicked(long widget) - Overrides:
gtk_clickedin classWidget
-
gtk_draw
-
mustBeVisibleOnInitBounds
boolean mustBeVisibleOnInitBounds()Description copied from class:ControlWidgets with unusual bounds calculation behavior can override this method to returntrueif the widget must be visible during call toControl.setInitialBounds().- Overrides:
mustBeVisibleOnInitBoundsin classControl- Returns:
falseby default on modern GTK 3 versions (3.20+).
-
gtk_focus_in_event
long gtk_focus_in_event(long widget, long event) - Overrides:
gtk_focus_in_eventin classControl
-
gtk_focus_out_event
long gtk_focus_out_event(long widget, long event) - Overrides:
gtk_focus_out_eventin classControl
-
gtk4_key_press_event
boolean gtk4_key_press_event(long controller, int keyval, int keycode, int state, long event) - Overrides:
gtk4_key_press_eventin classControl- Parameters:
controller- the corresponding controller responsible for capturing the eventkeyval- the pressed keykeycode- raw code of the pressed keystate- the bitmask, representing the state of the modifier keys and pointer buttonsevent- the GdkEvent captured- Returns:
- TRUE if the event has been fully/properly handled, otherwise FALSE
-
gtk3_key_press_event
long gtk3_key_press_event(long widget, long event) - Overrides:
gtk3_key_press_eventin classControl
-
hookEvents
void hookEvents()- Overrides:
hookEventsin classControl
-
isDescribedByLabel
boolean isDescribedByLabel()- Overrides:
isDescribedByLabelin classControl
-
mnemonicHit
boolean mnemonicHit(char key) - Overrides:
mnemonicHitin classControl
-
mnemonicMatch
boolean mnemonicMatch(char key) - Overrides:
mnemonicMatchin classControl
-
register
-
releaseHandle
void releaseHandle()- Overrides:
releaseHandlein classControl
-
releaseWidget
void releaseWidget()- Overrides:
releaseWidgetin classControl
-
removeSelectionListener
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:
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:
-
resizeHandle
void resizeHandle(int width, int height) - Overrides:
resizeHandlein classControl
-
selectRadio
void selectRadio() -
setAlignment
public void setAlignment(int alignment) Controls how text, images and arrows will be displayed in the receiver. The argument should be one ofLEFT,RIGHTorCENTERunless the receiver is anARROWbutton, in which case, the argument indicates the direction of the arrow (one ofLEFT,RIGHT,UPorDOWN).- Parameters:
alignment- the new alignment- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
_setAlignment
void _setAlignment(int alignment) -
setBackgroundGdkRGBA
- Overrides:
setBackgroundGdkRGBAin classControl
-
setBounds
-
setFontDescription
void setFontDescription(long fontDesc) - Overrides:
setFontDescriptionin classControl
-
setRadioSelection
boolean setRadioSelection(boolean value) - Overrides:
setRadioSelectionin classControl
-
setForegroundGdkRGBA
- Overrides:
setForegroundGdkRGBAin classControl
-
setForegroundGdkRGBA
- Overrides:
setForegroundGdkRGBAin classControl
-
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:
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
-
setImage
Sets the receiver's image to the argument, which may benullindicating that no image should be displayed.Note that a Button can display an image and text simultaneously.
- Parameters:
image- the image to display on the receiver (may benull)- Throws:
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
-
_setImage
-
setOrientation
void setOrientation(boolean create) - Overrides:
setOrientationin classControl
-
setSelection
public void setSelection(boolean selected) Sets the selection state of the receiver, if it is of typeCHECK,RADIO, orTOGGLE.When the receiver is of type
CHECKorRADIO, 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:
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
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- the new text- Throws:
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
-
updateWidgetsVisibility
private void updateWidgetsVisibility() -
showWidget
void showWidget()- Overrides:
showWidgetin classControl
-
traversalCode
int traversalCode(int key, long event) - Overrides:
traversalCodein classControl
-
windowProc
long windowProc(long handle, long arg0, long user_data) - Overrides:
windowProcin classControl
-
dpiChanged
long dpiChanged(long object, long arg0) - Overrides:
dpiChangedin classWidget
-
setEnabled
public void setEnabled(boolean enabled) Enables the receiver if the argument istrue, and disables it otherwise.A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.
- Overrides:
setEnabledin classControl- Parameters:
enabled- the new enabled state- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
disposeDefaultDisabledImage
private void disposeDefaultDisabledImage()
-