Instances of the receiver represent a selectable user interface object that allows the user to drag a rubber banded outline of the sash within the parent control.
Note: Only one of the styles HORIZONTAL and VERTICAL may be specified.
IMPORTANT: This class is not intended to be subclassed.
<init>(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 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.
| name | type | description |
|---|---|---|
| parent | org.eclipse.swt.widgets.Composite | a composite control which will be the parent of the new instance (cannot be null) |
| style | int | the style of control to construct |
| IllegalArgumentException |
|
|
| SWTException |
|
|
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 the SelectionListener
interface.
When widgetSelected is called, the x, y, width, and height fields of the event object are valid.
If the receiver is being dragged, the event object detail field contains the value SWT.DRAG.
widgetDefaultSelected is not called.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.SelectionListener | the listener which should be notified when the control is selected by the user |
| IllegalArgumentException |
|
|
| SWTException |
|
|
computeSize(int wHint, int hHint, boolean changed)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.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.SelectionListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addDisposeListener(org.eclipse.swt.events.DisposeListener listener)Adds the listener to the collection of listeners who will
be notified when the widget is disposed. When the widget is
disposed, the listener is notified by sending it the
widgetDisposed() message.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.DisposeListener | the listener which should be notified when the receiver is disposed |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addListener(int eventType, org.eclipse.swt.widgets.Listener listener)Adds the listener to the collection of listeners who will
be notified when an event of the given type occurs. When the
event does occur in the widget, the listener is notified by
sending it the handleEvent() message. The event
type is one of the event constants defined in class SWT.
| name | type | description |
|---|---|---|
| event_type | int | the type of event to listen for |
| listener | org.eclipse.swt.widgets.Listener | the listener which should be notified when the event occurs |
| IllegalArgumentException |
|
|
| SWTException |
|
|
isAutoDirection() · also: is_auto_directionReturns true if the widget has auto text direction,
and false otherwise.
Returns: true when the widget has auto direction and false otherwise
getData() · also: get_dataReturns the application defined widget data associated with the receiver, or null if it has not been set. The widget data is a single, unnamed field that is stored with every widget.
Applications may put arbitrary objects in this field. If the object stored in the widget data needs to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so.
Returns: the widget data
| SWTException |
|
|
setData(Object data) · also: set_dataSets the application defined widget data associated with the receiver to be the argument. The widget data is a single, unnamed field that is stored with every widget.
Applications may put arbitrary objects in this field. If the object stored in the widget data needs to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so.
| name | type | description |
|---|---|---|
| data | Object | the widget data |
| SWTException |
|
|
Returns the Display that is associated with
the receiver.
A widget's display is either provided when it is created
(for example, top level Shells) or is the
same as its parent's display.
Returns: the receiver's display
| SWTException |
|
|
dispose()Disposes of the operating system resources associated with
the receiver and all its descendants. After this method has
been invoked, the receiver and all descendants will answer
true when sent the message isDisposed().
Any internal connections between the widgets in the tree will
have been removed to facilitate garbage collection.
This method does nothing if the widget is already disposed.
NOTE: This method is not called recursively on the descendants
of the receiver. This means that, widget implementers can not
detect when a widget is being disposed of by re-implementing
this method, but should instead listen for the Dispose
event.
| SWTException |
|
|
isDisposed() · also: is_disposedReturns true if the widget has been disposed,
and false otherwise.
This method gets the dispose state for the widget.
When a widget has been disposed, it is an error to
invoke any other method (except #dispose()) using the widget.
Returns: true when the widget is disposed and false otherwise
getData(String key)Returns the application defined property of the receiver with the specified name, or null if it has not been set.
Applications may have associated arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so.
| name | type | description |
|---|---|---|
| key | String | the name of the property |
Returns: the value of the property or null if it has not been set
| IllegalArgumentException |
|
|
| SWTException |
|
|
Returns an array of listeners who will be notified when an event
of the given type occurs. The event type is one of the event constants
defined in class SWT.
| name | type | description |
|---|---|---|
| event_type | int | the type of event to listen for |
Returns: an array of listeners that will be notified when the event occurs
| SWTException |
|
|
getTypedListeners(int eventType, Class<L> listenerType)Returns the typed listeners who will be notified when an event of the given type occurs.
The event type is one of the event constants defined in class SWT
and the specified listener-type must correspond to that event.
If for example the eventType is SWT#Selection,
the listeners type should be SelectionListener.
| name | type | description |
|---|---|---|
| event_type | int | the type of event to listen for |
Returns: a stream of typed listeners that will be notified when the event occurs
| SWTException |
|
|
isListening(int eventType)Returns true if there are any listeners
for the specified event type associated with the receiver,
and false otherwise. The event type is one of
the event constants defined in class SWT.
| name | type | description |
|---|---|---|
| event_type | int | the type of event |
Returns: true if the event is hooked
| SWTException |
|
|
notifyListeners(int eventType, org.eclipse.swt.widgets.Event event)Notifies all of the receiver's listeners for events
of the given type that one such event has occurred by
invoking their handleEvent() method. The
event type is one of the event constants defined in class
SWT.
| name | type | description |
|---|---|---|
| event_type | int | the type of event which has occurred |
| event | org.eclipse.swt.widgets.Event | the event data |
| SWTException |
|
|
removeDisposeListener(org.eclipse.swt.events.DisposeListener listener)Removes the listener from the collection of listeners who will be notified when the widget is disposed.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.DisposeListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeListener(int eventType, org.eclipse.swt.widgets.Listener listener)Removes the listener from the collection of listeners who will
be notified when an event of the given type occurs. The event
type is one of the event constants defined in class SWT.
| name | type | description |
|---|---|---|
| event_type | int | the type of event to listen for |
| listener | org.eclipse.swt.widgets.Listener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
reskin(int flags)Marks the widget to be skinned.
The skin event is sent to the receiver's display when appropriate (usually before the next event
is handled). Widgets are automatically marked for skinning upon creation as well as when its skin
id or class changes. The skin id and/or class can be changed by calling Display#setData(String, Object)
with the keys SWT#SKIN_ID and/or SWT#SKIN_CLASS. Once the skin event is sent to a widget, it
will not be sent again unless reskin(int) is called on the widget or on an ancestor
while specifying the SWT.ALL flag.
The parameter flags may be either:
SWT#ALLSWT#NONE| name | type | description |
|---|---|---|
| flags | int | the flags specifying how to reskin |
| SWTException |
|
|
setData(String key, Object value)Sets the application defined property of the receiver with the specified name to the given value.
Applications may associate arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so.
| name | type | description |
|---|---|---|
| key | String | the name of the property |
| value | Object | the new value for the property |
| IllegalArgumentException |
|
|
| SWTException |
|
|
getStyle() · also: get_styleReturns the receiver's style information.
Note that the value which is returned by this method may
not match the value which was provided to the constructor
when the receiver was created. This can occur when the underlying
operating system does not support a particular combination of
requested styles. For example, if the platform widget used to
implement a particular SWT widget always has scroll bars, the
result of calling this method would always have the
SWT.H_SCROLL and SWT.V_SCROLL bits set.
Returns: the style bits
| SWTException |
|
|
toString()Returns a string containing a concise, human-readable description of the receiver.
Returns: a string representation of the receiver
isAutoScalable() · also: is_auto_scalableReturns true iff coordinates can be auto-scaled on this
drawable and false if not. E.g. a GC method should not
auto-scale the bounds of a figure drawn on a Printer device, but it may have
to auto-scale when drawing on a high-DPI Display monitor.
Returns: true if auto-scaling is enabled for this drawable
| field | type | note |
|---|---|---|
| view | NSView | the handle to the OS resource
(Warning: This field is platform dependent)
IMPORTANT: This field is not part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code. |
Returns the accessible object for the receiver.
If this is the first time this object is requested, then the object is created and returned. The object returned by getAccessible() does not need to be disposed.
Returns: the accessible object
| SWTException |
|
|
addControlListener(org.eclipse.swt.events.ControlListener listener)Adds the listener to the collection of listeners who will
be notified when the control is moved or resized, by sending
it one of the messages defined in the ControlListener
interface.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.ControlListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addDragDetectListener(org.eclipse.swt.events.DragDetectListener listener)Adds the listener to the collection of listeners who will
be notified when a drag gesture occurs, by sending it
one of the messages defined in the DragDetectListener
interface.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.DragDetectListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addFocusListener(org.eclipse.swt.events.FocusListener listener)Adds the listener to the collection of listeners who will
be notified when the control gains or loses focus, by sending
it one of the messages defined in the FocusListener
interface.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.FocusListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addGestureListener(org.eclipse.swt.events.GestureListener listener)Adds the listener to the collection of listeners who will
be notified when gesture events are generated for the control,
by sending it one of the messages defined in the
GestureListener interface.
NOTE: If setTouchEnabled(true) has previously been
invoked on the receiver then setTouchEnabled(false)
must be invoked on it to specify that gesture events should be
sent instead of touch events.
Warning: This API is currently only implemented on Windows and Cocoa. SWT doesn't send Gesture or Touch events on GTK.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.GestureListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addHelpListener(org.eclipse.swt.events.HelpListener listener)Adds the listener to the collection of listeners who will
be notified when help events are generated for the control,
by sending it one of the messages defined in the
HelpListener interface.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.HelpListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addKeyListener(org.eclipse.swt.events.KeyListener listener)Adds the listener to the collection of listeners who will
be notified when keys are pressed and released on the system keyboard, by sending
it one of the messages defined in the KeyListener
interface.
When a key listener is added to a control, the control will take part in widget traversal. By default, all traversal keys (such as the tab key and so on) are delivered to the control. In order for a control to take part in traversal, it should listen for traversal events. Otherwise, the user can traverse into a control but not out. Note that native controls such as table and tree implement key traversal in the operating system. It is not necessary to add traversal listeners for these controls, unless you want to override the default traversal.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.KeyListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addMouseListener(org.eclipse.swt.events.MouseListener listener)Adds the listener to the collection of listeners who will
be notified when mouse buttons are pressed and released, by sending
it one of the messages defined in the MouseListener
interface.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.MouseListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addMouseMoveListener(org.eclipse.swt.events.MouseMoveListener listener)Adds the listener to the collection of listeners who will
be notified when the mouse moves, by sending it one of the
messages defined in the MouseMoveListener
interface.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.MouseMoveListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addMouseTrackListener(org.eclipse.swt.events.MouseTrackListener listener)Adds the listener to the collection of listeners who will
be notified when the mouse passes or hovers over controls, by sending
it one of the messages defined in the MouseTrackListener
interface.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.MouseTrackListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addMouseWheelListener(org.eclipse.swt.events.MouseWheelListener listener)Adds the listener to the collection of listeners who will
be notified when the mouse wheel is scrolled, by sending
it one of the messages defined in the
MouseWheelListener interface.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.MouseWheelListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addPaintListener(org.eclipse.swt.events.PaintListener listener)Adds the listener to the collection of listeners who will
be notified when the receiver needs to be painted, by sending it
one of the messages defined in the PaintListener
interface.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.PaintListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addTouchListener(org.eclipse.swt.events.TouchListener listener)Adds the listener to the collection of listeners who will
be notified when touch events occur, by sending it
one of the messages defined in the TouchListener
interface.
NOTE: You must also call setTouchEnabled(true) to
specify that touch events should be sent, which will cause gesture
events to not be sent.
Warning: This API is currently only implemented on Windows and Cocoa. SWT doesn't send Gesture or Touch events on GTK.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.TouchListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
addTraverseListener(org.eclipse.swt.events.TraverseListener listener)Adds the listener to the collection of listeners who will
be notified when traversal events occur, by sending it
one of the messages defined in the TraverseListener
interface.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.TraverseListener | the listener which should be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
setAutoscalingMode(org.eclipse.swt.graphics.AutoscalingMode autoscalingMode) · also: set_autoscaling_modeSets the autoscaling mode for this widget. The capability is not supported on
every platform, such that calling this method may not have an effect on
unsupported platforms. The return value indicates if the autoscale mode was
set properly. With #isAutoScalable(), the autoscale enablement can
also be evaluated at any later point in time.
Currently, this is only supported on Windows.
| name | type | description |
|---|---|---|
| autoscaling_mode | org.eclipse.swt.graphics.AutoscalingMode | the autoscaling mode to set |
Returns: false if the operation was called on an unsupported platform
Returns the receiver's background color.
Note: This operation is a hint and may be overridden by the platform. For example, on some versions of Windows the background of a TabFolder, is a gradient rather than a solid color.
Returns: the background color
| SWTException |
|
|
setBackground(org.eclipse.swt.graphics.Color color) · also: set_backgroundSets 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 a hint and may be overridden by the platform.
Note: The background color can be overridden by setting a background image.
| name | type | description |
|---|---|---|
| color | org.eclipse.swt.graphics.Color | the new color (or null) |
| IllegalArgumentException |
|
|
| SWTException |
|
|
Returns the receiver's background image.
Returns: the background image
| SWTException |
|
|
setBackgroundImage(org.eclipse.swt.graphics.Image image) · also: set_background_imageSets the receiver's background image to the image specified by the argument, or to the default system color for the control if the argument is null. The background image is tiled to fill the available space.
Note: This operation is a hint and may be overridden by the platform. For example, on Windows the background of a Button cannot be changed.
Note: Setting a background image overrides a set background color.
| name | type | description |
|---|---|---|
| image | org.eclipse.swt.graphics.Image | the new image (or null) |
| IllegalArgumentException |
|
|
| SWTException |
|
|
getBorderWidth() · also: get_border_widthReturns the receiver's border width in points.
Returns: the border width
| SWTException |
|
|
Returns a rectangle describing the receiver's size and location in points relative to its parent (or its display if its parent is null), unless the receiver is a shell. In this case, the location is relative to the display.
Returns: the receiver's bounding rectangle
| SWTException |
|
|
setBounds(org.eclipse.swt.graphics.Rectangle rect) · also: set_boundsSets the receiver's size and location in points to the rectangular
area specified by the argument. The x and
y fields of the rectangle are relative to
the receiver's parent (or its display if its parent is null).
Note: Attempting to set the width or height of the receiver to a negative number will cause that value to be set to zero instead.
Note: On GTK, attempting to set the width or height of the receiver to a number higher or equal 2^14 will cause them to be set to (2^14)-1 instead.
| name | type | description |
|---|---|---|
| rect | org.eclipse.swt.graphics.Rectangle | the new bounds for the receiver |
| SWTException |
|
|
setCapture(boolean capture) · also: set_captureIf the argument is true, causes the receiver to have
all mouse events delivered to it until the method is called with
false as the argument. Note that on some platforms,
a mouse button must currently be down for capture to be assigned.
| name | type | description |
|---|---|---|
| capture | boolean | true to capture the mouse, and false to release it |
| SWTException |
|
|
Returns the preferred size (in points) of the receiver.
The preferred size of a control is the size that it would
best be displayed at. The width hint and height hint arguments
allow the caller to ask a control questions such as "Given a particular
width, how high does the control need to be to show all of the contents?"
To indicate that the caller does not wish to constrain a particular
dimension, the constant SWT.DEFAULT is passed for the hint.
| name | type | description |
|---|---|---|
| w_hint | int | the width hint (can be SWT.DEFAULT) |
| h_hint | int | the height hint (can be SWT.DEFAULT) |
Returns: the preferred size of the control
| SWTException |
|
|
Returns the receiver's cursor, or null if it has not been set.
When the mouse pointer passes over a control its appearance is changed to match the control's cursor.
Returns: the receiver's cursor or null
| SWTException |
|
|
setCursor(org.eclipse.swt.graphics.Cursor cursor) · also: set_cursorSets the receiver's cursor to the cursor specified by the argument, or to the default cursor for that kind of control if the argument is null.
When the mouse pointer passes over a control its appearance is changed to match the control's cursor.
| name | type | description |
|---|---|---|
| cursor | org.eclipse.swt.graphics.Cursor | the new cursor (or null) |
| IllegalArgumentException |
|
|
| SWTException |
|
|
Detects a drag and drop gesture. This method is used to detect a drag gesture when called from within a mouse down listener.
By default, a drag is detected when the gesture
occurs anywhere within the client area of a control.
Some controls, such as tables and trees, override this
behavior. In addition to the operating system specific
drag gesture, they require the mouse to be inside an
item. Custom widget writers can use setDragDetect
to disable the default detection, listen for mouse down,
and then call dragDetect() from within the
listener to conditionally detect a drag.
| name | type | description |
|---|---|---|
| event | org.eclipse.swt.widgets.Event | the mouse down event |
Returns: true if the gesture occurred, and false otherwise.
| IllegalArgumentException |
|
|
| SWTException |
|
|
Detects a drag and drop gesture. This method is used to detect a drag gesture when called from within a mouse down listener.
By default, a drag is detected when the gesture
occurs anywhere within the client area of a control.
Some controls, such as tables and trees, override this
behavior. In addition to the operating system specific
drag gesture, they require the mouse to be inside an
item. Custom widget writers can use setDragDetect
to disable the default detection, listen for mouse down,
and then call dragDetect() from within the
listener to conditionally detect a drag.
| name | type | description |
|---|---|---|
| event | org.eclipse.swt.events.MouseEvent | the mouse down event |
Returns: true if the gesture occurred, and false otherwise.
| IllegalArgumentException |
|
|
| SWTException |
|
|
getDragDetect() · also: get_drag_detectReturns true if the receiver is detecting
drag gestures, and false otherwise.
Returns: the receiver's drag detect state
| SWTException |
|
|
setDragDetect(boolean dragDetect) · also: set_drag_detectSets the receiver's drag detect state. If the argument is
true, the receiver will detect drag gestures,
otherwise these gestures will be ignored.
| name | type | description |
|---|---|---|
| drag_detect | boolean | the new drag detect state |
| SWTException |
|
|
getEnabled() · also: get_enabledReturns true if the receiver is enabled, and
false otherwise. A disabled control is typically
not selectable from the user interface and draws with an
inactive or "grayed" look.
Returns: the receiver's enabled state
| SWTException |
|
|
setEnabled(boolean enabled) · also: set_enabledEnables 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.
| name | type | description |
|---|---|---|
| enabled | boolean | the new enabled state |
| SWTException |
|
|
isEnabled() · also: is_enabledReturns true if the receiver is enabled and all
ancestors up to and including the receiver's nearest ancestor
shell are enabled. Otherwise, false is returned.
A disabled control is typically not selectable from the user
interface and draws with an inactive or "grayed" look.
Returns: the receiver's enabled state
| SWTException |
|
|
isFocusControl() · also: is_focus_controlReturns true if the receiver has the user-interface
focus, and false otherwise.
Returns: the receiver's focus state
| SWTException |
|
|
Returns the font that the receiver will use to paint textual information.
Returns: the receiver's font
| SWTException |
|
|
Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.
| name | type | description |
|---|---|---|
| font | org.eclipse.swt.graphics.Font | the new font (or null) |
| IllegalArgumentException |
|
|
| SWTException |
|
|
forceFocus()Forces the receiver to have the keyboard focus, causing all keyboard events to be delivered to it.
Returns: true if the control got focus, and false if it was unable to.
| SWTException |
|
|
Returns the foreground color that the receiver will use to draw.
Returns: the receiver's foreground color
| SWTException |
|
|
setForeground(org.eclipse.swt.graphics.Color color) · also: set_foregroundSets 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 a hint and may be overridden by the platform.
| name | type | description |
|---|---|---|
| color | org.eclipse.swt.graphics.Color | the new color (or null) |
| IllegalArgumentException |
|
|
| SWTException |
|
|
internal_dispose_GC(long hDC, org.eclipse.swt.graphics.GCData data)Invokes platform specific functionality to dispose a GC handle.
IMPORTANT: This method is not part of the public
API for Control. It is marked public only so that it
can be shared within the packages provided by SWT. It is not
available on all platforms, and should never be called from
application code.
| name | type | description |
|---|---|---|
| h_dc | long | the platform specific GC handle |
| data | org.eclipse.swt.graphics.GCData | the platform specific GC data |
Invokes platform specific functionality to allocate a new GC handle.
IMPORTANT: This method is not part of the public
API for Control. It is marked public only so that it
can be shared within the packages provided by SWT. It is not
available on all platforms, and should never be called from
application code.
| name | type | description |
|---|---|---|
| data | org.eclipse.swt.graphics.GCData | the platform specific GC data |
Returns: the platform specific GC handle
getLayoutData() · also: get_layout_dataReturns layout data which is associated with the receiver.
Returns: the receiver's layout data
| SWTException |
|
|
setLayoutData(Object layoutData) · also: set_layout_dataSets the layout data associated with the receiver to the argument.
| name | type | description |
|---|---|---|
| layout_data | Object | the new layout data for the receiver. |
| SWTException |
|
|
Returns a point describing the receiver's location relative to its parent in points (or its display if its parent is null), unless the receiver is a shell. In this case, the point is usually relative to the display.
Warning: When executing this operation on a shell, it may not yield a value with the expected meaning on some platforms. For example, executing this operation on a shell when the environment uses the Wayland protocol, the result is not a coordinate relative to the display. It will not change when moving the shell.
Returns: the receiver's location
| SWTException |
|
|
setLocation(org.eclipse.swt.graphics.Point location) · also: set_locationSets the receiver's location to the point specified by the argument which is relative to the receiver's parent (or its display if its parent is null), unless the receiver is a shell. In this case, the point is relative to the display.
Warning: When executing this operation on a shell, it may not have the intended effect on some platforms. For example, executing this operation on a shell when the environment uses the Wayland protocol, nothing will happen.
| name | type | description |
|---|---|---|
| location | org.eclipse.swt.graphics.Point | the new location for the receiver |
| SWTException |
|
|
Returns the receiver's monitor.
Returns: the receiver's monitor
| SWTException |
|
|
Moves the receiver above the specified control in the drawing order. If the argument is null, then the receiver is moved to the top of the drawing order. The control at the top of the drawing order will not be covered by other controls even if they occupy intersecting areas.
| name | type | description |
|---|---|---|
| control | org.eclipse.swt.widgets.Control | the sibling control (or null) |
| IllegalArgumentException |
|
|
| SWTException |
|
|
Moves the receiver below the specified control in the drawing order. If the argument is null, then the receiver is moved to the bottom of the drawing order. The control at the bottom of the drawing order will be covered by all other controls which occupy intersecting areas.
| name | type | description |
|---|---|---|
| control | org.eclipse.swt.widgets.Control | the sibling control (or null) |
| IllegalArgumentException |
|
|
| SWTException |
|
|
getOrientation() · also: get_orientationReturns the orientation of the receiver, which will be one of the
constants SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT.
Returns: the orientation style
| SWTException |
|
|
setOrientation(int orientation) · also: set_orientationSets the orientation of the receiver, which must be one
of the constants SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT.
| name | type | description |
|---|---|---|
| orientation | int | new orientation style |
| SWTException |
|
|
pack()Causes the receiver to be resized to its preferred size. For a composite, this involves computing the preferred size from its layout, if there is one.
| SWTException |
|
|
pack(boolean changed)Causes the receiver to be resized to its preferred size. For a composite, this involves computing the preferred size from its layout, if there is one.
If the changed flag is true, it indicates that the receiver's
contents have changed, therefore any caches that a layout manager
containing the control may have been keeping need to be flushed. When the
control is resized, the changed flag will be false, so layout
manager caches can be retained.
| name | type | description |
|---|---|---|
| changed | boolean | whether or not the receiver's contents have changed |
| SWTException |
|
|
Returns the receiver's parent, which must be a Composite
or null when the receiver is a shell that was created with null or
a display for a parent.
Returns: the receiver's parent
| SWTException |
|
|
setParent(org.eclipse.swt.widgets.Composite parent) · also: set_parentChanges the parent of the widget to be the one provided.
Returns true if the parent is successfully changed.
| name | type | description |
|---|---|---|
| parent | org.eclipse.swt.widgets.Composite | the new parent for the control. |
Returns: true if the parent is changed and false otherwise.
| IllegalArgumentException |
|
|
| SWTException |
|
|
Prints the receiver and all children.
| name | type | description |
|---|---|---|
| gc | org.eclipse.swt.graphics.GC | the gc where the drawing occurs |
Returns: true if the operation was successful and false otherwise
| IllegalArgumentException |
|
|
| SWTException |
|
|
redraw()Causes the entire bounds of the receiver to be marked as needing to be redrawn. The next time a paint request is processed, the control will be completely painted, including the background.
Schedules a paint request if the invalidated area is visible
or becomes visible later. It is not necessary for the caller
to explicitly call #update() after calling this method,
but depending on the platform, the automatic repaints may be
delayed considerably.
| SWTException |
|
|
redraw(int x, int y, int width, int height, boolean all)Causes the rectangular area of the receiver specified by
the arguments to be marked as needing to be redrawn.
The next time a paint request is processed, that area of
the receiver will be painted, including the background.
If the all flag is true, any
children of the receiver which intersect with the specified
area will also paint their intersecting areas. If the
all flag is false, the children
will not be painted.
Schedules a paint request if the invalidated area is visible
or becomes visible later. It is not necessary for the caller
to explicitly call #update() after calling this method,
but depending on the platform, the automatic repaints may be
delayed considerably.
| name | type | description |
|---|---|---|
| x | int | the x coordinate of the area to draw |
| y | int | the y coordinate of the area to draw |
| width | int | the width of the area to draw |
| height | int | the height of the area to draw |
| all | boolean | true if children should redraw, and false otherwise |
| SWTException |
|
|
setRedraw(boolean redraw) · also: set_redrawIf the argument is false, causes subsequent drawing
operations in the receiver to be ignored. No drawing of any kind
can occur in the receiver until the flag is set to true.
Graphics operations that occurred while the flag was
false are lost. When the flag is set to true,
the entire widget is marked as needing to be redrawn. Nested calls
to this method are stacked.
Note: This operation is a hint and may not be supported on some platforms or for some widgets.
| name | type | description |
|---|---|---|
| redraw | boolean | the new redraw state |
| SWTException |
|
|
Returns the region that defines the shape of the control, or null if the control has the default shape.
Returns: the region that defines the shape of the shell (or null)
| SWTException |
|
|
setRegion(org.eclipse.swt.graphics.Region region) · also: set_regionSets the shape of the control to the region specified by the argument. When the argument is null, the default shape of the control is restored.
| name | type | description |
|---|---|---|
| region | org.eclipse.swt.graphics.Region | the region that defines the shape of the control (or null) |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeControlListener(org.eclipse.swt.events.ControlListener listener)Removes the listener from the collection of listeners who will be notified when the control is moved or resized.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.ControlListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeDragDetectListener(org.eclipse.swt.events.DragDetectListener listener)Removes the listener from the collection of listeners who will be notified when a drag gesture occurs.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.DragDetectListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeFocusListener(org.eclipse.swt.events.FocusListener listener)Removes the listener from the collection of listeners who will be notified when the control gains or loses focus.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.FocusListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeGestureListener(org.eclipse.swt.events.GestureListener listener)Removes the listener from the collection of listeners who will be notified when gesture events are generated for the control.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.GestureListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeHelpListener(org.eclipse.swt.events.HelpListener listener)Removes the listener from the collection of listeners who will be notified when the help events are generated for the control.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.HelpListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeKeyListener(org.eclipse.swt.events.KeyListener listener)Removes the listener from the collection of listeners who will be notified when keys are pressed and released on the system keyboard.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.KeyListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeMouseListener(org.eclipse.swt.events.MouseListener listener)Removes the listener from the collection of listeners who will be notified when mouse buttons are pressed and released.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.MouseListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeMouseMoveListener(org.eclipse.swt.events.MouseMoveListener listener)Removes the listener from the collection of listeners who will be notified when the mouse moves.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.MouseMoveListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeMouseTrackListener(org.eclipse.swt.events.MouseTrackListener listener)Removes the listener from the collection of listeners who will be notified when the mouse passes or hovers over controls.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.MouseTrackListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeMouseWheelListener(org.eclipse.swt.events.MouseWheelListener listener)Removes the listener from the collection of listeners who will be notified when the mouse wheel is scrolled.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.MouseWheelListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removePaintListener(org.eclipse.swt.events.PaintListener listener)Removes the listener from the collection of listeners who will be notified when the receiver needs to be painted.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.PaintListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeTouchListener(org.eclipse.swt.events.TouchListener listener)Removes the listener from the collection of listeners who will be notified when touch events occur.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.TouchListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
removeTraverseListener(org.eclipse.swt.events.TraverseListener listener)Removes the listener from the collection of listeners who will be notified when traversal events occur.
| name | type | description |
|---|---|---|
| listener | org.eclipse.swt.events.TraverseListener | the listener which should no longer be notified |
| IllegalArgumentException |
|
|
| SWTException |
|
|
isReparentable() · also: is_reparentableReturns true if the underlying operating
system supports this reparenting, otherwise false
Returns: true if the widget can be reparented, otherwise false
| SWTException |
|
|
requestLayout()Requests that this control and all of its ancestors be repositioned by their layouts at the earliest opportunity. This should be invoked after modifying the control in order to inform any dependent layouts of the change.
The control will not be repositioned synchronously. This method is fast-running and only marks the control for future participation in a deferred layout.
Invoking this method multiple times before the layout occurs is an inexpensive no-op.
setBounds(int x, int y, int width, int height)Sets the receiver's size and location in points to the rectangular
area specified by the arguments. The x and
y arguments are relative to the receiver's
parent (or its display if its parent is null), unless
the receiver is a shell. In this case, the x
and y arguments are relative to the display.
Note: Attempting to set the width or height of the receiver to a negative number will cause that value to be set to zero instead.
Note: On GTK, attempting to set the width or height of the receiver to a number higher or equal 2^14 will cause them to be set to (2^14)-1 instead.
| name | type | description |
|---|---|---|
| x | int | the new x coordinate for the receiver |
| y | int | the new y coordinate for the receiver |
| width | int | the new width for the receiver |
| height | int | the new height for the receiver |
| SWTException |
|
|
setFocus()Causes the receiver to have the keyboard focus, such that all keyboard events will be delivered to it. Focus reassignment will respect applicable platform constraints.
Returns: true if the control got focus, and false if it was unable to.
| SWTException |
|
|
setLocation(int x, int y)Sets the receiver's location to the point specified by the arguments which are relative to the receiver's parent (or its display if its parent is null), unless the receiver is a shell. In this case, the point is relative to the display.
Warning: When executing this operation on a shell, it may not have the intended effect on some platforms. For example, executing this operation on a shell when the environment uses the Wayland protocol, nothing will happen.
| name | type | description |
|---|---|---|
| x | int | the new x coordinate for the receiver |
| y | int | the new y coordinate for the receiver |
| SWTException |
|
|
setSize(int width, int height)Sets the receiver's size to the point specified by the arguments.
Note: Attempting to set the width or height of the receiver to a negative number will cause that value to be set to zero instead.
Note: On GTK, attempting to set the width or height of the receiver to a number higher or equal 2^14 will cause them to be set to (2^14)-1 instead.
| name | type | description |
|---|---|---|
| width | int | the new width in points for the receiver |
| height | int | the new height in points for the receiver |
| SWTException |
|
|
Returns the receiver's shell. For all controls other than shells, this simply returns the control's nearest ancestor shell. Shells return themselves, even if they are children of other shells.
Returns: the receiver's shell
| SWTException |
|
|
Returns a point describing the receiver's size in points. The x coordinate of the result is the width of the receiver. The y coordinate of the result is the height of the receiver.
Returns: the receiver's size
| SWTException |
|
|
Sets the receiver's size to the point specified by the argument.
Note: Attempting to set the width or height of the receiver to a negative number will cause them to be set to zero instead.
Note: On GTK, attempting to set the width or height of the receiver to a number higher or equal 2^14 will cause them to be set to (2^14)-1 instead.
| name | type | description |
|---|---|---|
| size | org.eclipse.swt.graphics.Point | the new size in points for the receiver |
| IllegalArgumentException |
|
|
| SWTException |
|
|
getTextDirection() · also: get_text_directionReturns the text direction of the receiver, which will be one of the
constants SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT.
Returns: the text direction style
| SWTException |
|
|
setTextDirection(int textDirection) · also: set_text_directionSets the base text direction (a.k.a. "paragraph direction") of the receiver,
which must be one of the constants SWT.LEFT_TO_RIGHT,
SWT.RIGHT_TO_LEFT, or SWT.AUTO_TEXT_DIRECTION.
setOrientation would override this value with the text direction
that is consistent with the new orientation.
Warning: This API is currently only implemented on Windows. It doesn't set the base text direction on GTK and Cocoa.
| name | type | description |
|---|---|---|
| text_direction | int | the base text direction style |
| SWTException |
|
|
Returns a point which is the result of converting the argument, which is specified in display relative coordinates, to coordinates relative to the receiver.
NOTE: To properly map a rectangle or a corner of a rectangle on a right-to-left platform, use
Display#map(Control, Control, Rectangle).
| name | type | description |
|---|---|---|
| x | int | the x coordinate in points to be translated |
| y | int | the y coordinate in points to be translated |
Returns: the translated coordinates
| SWTException |
|
|
Returns a point which is the result of converting the argument, which is specified in display relative coordinates, to coordinates relative to the receiver.
NOTE: To properly map a rectangle or a corner of a rectangle on a right-to-left platform, use
Display#map(Control, Control, Rectangle).
| name | type | description |
|---|---|---|
| point | org.eclipse.swt.graphics.Point | the point to be translated (must not be null) |
Returns: the translated coordinates
| IllegalArgumentException |
|
|
| SWTException |
|
|
Returns a point which is the result of converting the argument, which is specified in coordinates relative to the receiver, to display relative coordinates.
NOTE: To properly map a rectangle or a corner of a rectangle on a right-to-left platform, use
Display#map(Control, Control, Rectangle).
| name | type | description |
|---|---|---|
| x | int | the x coordinate to be translated |
| y | int | the y coordinate to be translated |
Returns: the translated coordinates
| SWTException |
|
|
Returns a point which is the result of converting the argument, which is specified in coordinates relative to the receiver, to display relative coordinates.
NOTE: To properly map a rectangle or a corner of a rectangle on a right-to-left platform, use
Display#map(Control, Control, Rectangle).
| name | type | description |
|---|---|---|
| point | org.eclipse.swt.graphics.Point | the point to be translated (must not be null) |
Returns: the translated coordinates
| IllegalArgumentException |
|
|
| SWTException |
|
|
getToolTipText() · also: get_tool_tip_textReturns the receiver's tool tip text, or null if it has not been set.
Returns: the receiver's tool tip text
| SWTException |
|
|
setToolTipText(String string) · also: set_tool_tip_textSets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown. For a control that has a default tool tip, such as the Tree control on Windows, setting the tool tip text to an empty string replaces the default, causing no tool tip text to be shown.
The mnemonic indicator (character '&') is not displayed in a tool tip. To display a single '&' in the tool tip, the character '&' can be escaped by doubling it in the string.
NOTE: This operation is a hint and behavior is platform specific, on Windows for CJK-style mnemonics of the form " (&C)" at the end of the tooltip text are not shown in tooltip.
| name | type | description |
|---|---|---|
| string | String | the new tool tip text (or null) |
| SWTException |
|
|
getTouchEnabled() · also: get_touch_enabledReturns true if this control is set to send touch events, or
false if it is set to send gesture events instead. This method
also returns false if a touch-based input device is not detected
(this can be determined with Display#getTouchEnabled()). Use
#setTouchEnabled(boolean) to switch the events that a control sends
between touch events and gesture events.
Returns: true if the control is set to send touch events, or false otherwise
| SWTException |
|
|
setTouchEnabled(boolean enabled) · also: set_touch_enabledSets whether this control should send touch events (by default controls do not).
Setting this to false causes the receiver to send gesture events
instead. No exception is thrown if a touch-based input device is not
detected (this can be determined with Display#getTouchEnabled()).
| name | type | description |
|---|---|---|
| enabled | boolean | the new touch-enabled state |
| SWTException |
|
|
traverse(int traversal, org.eclipse.swt.widgets.Event event)Performs a platform traversal action corresponding to a KeyDown event.
Valid traversal values are
SWT.TRAVERSE_NONE, SWT.TRAVERSE_MNEMONIC,
SWT.TRAVERSE_ESCAPE, SWT.TRAVERSE_RETURN,
SWT.TRAVERSE_TAB_NEXT, SWT.TRAVERSE_TAB_PREVIOUS,
SWT.TRAVERSE_ARROW_NEXT, SWT.TRAVERSE_ARROW_PREVIOUS,
SWT.TRAVERSE_PAGE_NEXT and SWT.TRAVERSE_PAGE_PREVIOUS.
If traversal is SWT.TRAVERSE_NONE then the Traverse
event is created with standard values based on the KeyDown event. If
traversal is one of the other traversal constants then the Traverse
event is created with this detail, and its doit is taken from the
KeyDown event.
| name | type | description |
|---|---|---|
| traversal | int | the type of traversal, or SWT.TRAVERSE_NONE to compute
this from event |
| event | org.eclipse.swt.widgets.Event | the KeyDown event |
Returns: true if the traversal succeeded
| IllegalArgumentException |
|
|
| SWTException |
|
|
traverse(int traversal, org.eclipse.swt.events.KeyEvent event)Performs a platform traversal action corresponding to a KeyDown event.
Valid traversal values are
SWT.TRAVERSE_NONE, SWT.TRAVERSE_MNEMONIC,
SWT.TRAVERSE_ESCAPE, SWT.TRAVERSE_RETURN,
SWT.TRAVERSE_TAB_NEXT, SWT.TRAVERSE_TAB_PREVIOUS,
SWT.TRAVERSE_ARROW_NEXT, SWT.TRAVERSE_ARROW_PREVIOUS,
SWT.TRAVERSE_PAGE_NEXT and SWT.TRAVERSE_PAGE_PREVIOUS.
If traversal is SWT.TRAVERSE_NONE then the Traverse
event is created with standard values based on the KeyDown event. If
traversal is one of the other traversal constants then the Traverse
event is created with this detail, and its doit is taken from the
KeyDown event.
| name | type | description |
|---|---|---|
| traversal | int | the type of traversal, or SWT.TRAVERSE_NONE to compute
this from event |
| event | org.eclipse.swt.events.KeyEvent | the KeyDown event |
Returns: true if the traversal succeeded
| IllegalArgumentException |
|
|
| SWTException |
|
|
traverse(int traversal)Based on the argument, perform one of the expected platform
traversal action. The argument should be one of the constants:
SWT.TRAVERSE_ESCAPE, SWT.TRAVERSE_RETURN,
SWT.TRAVERSE_TAB_NEXT, SWT.TRAVERSE_TAB_PREVIOUS,
SWT.TRAVERSE_ARROW_NEXT, SWT.TRAVERSE_ARROW_PREVIOUS,
SWT.TRAVERSE_PAGE_NEXT and SWT.TRAVERSE_PAGE_PREVIOUS.
| name | type | description |
|---|---|---|
| traversal | int | the type of traversal |
Returns: true if the traversal succeeded
| SWTException |
|
|
update()Forces all outstanding paint requests for the widget to be processed before this method returns. If there are no outstanding paint request, this method does nothing.
Note:
| SWTException |
|
|
getVisible() · also: get_visibleReturns true if the receiver is visible, and
false otherwise.
If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.
Returns: the receiver's visibility state
| SWTException |
|
|
setVisible(boolean visible) · also: set_visibleMarks the receiver as visible if the argument is true,
and marks it invisible otherwise.
If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.
| name | type | description |
|---|---|---|
| visible | boolean | the new visibility state |
| SWTException |
|
|
isVisible() · also: is_visibleReturns true if the receiver is visible and all
ancestors up to and including the receiver's nearest ancestor
shell are visible. Otherwise, false is returned.
Returns: the receiver's visibility state
| SWTException |
|
|