Class Shell
- All Implemented Interfaces:
Drawable
Display
as the argument) are described
as top level shells. Instances that do have
a parent are described as secondary or
dialog shells.
Instances are always displayed in one of the maximized, minimized or normal states:
-
When an instance is marked as maximized, the
window manager will typically resize it to fill the
entire visible area of the display, and the instance
is usually put in a state where it can not be resized
(even if it has style
RESIZE
) until it is no longer maximized. - When an instance is in the normal state (neither maximized or minimized), its appearance is controlled by the style constants which were specified when it was created and the restrictions of the window manager (see below).
- When an instance has been marked as minimized, its contents (client area) will usually not be visible, and depending on the window manager, it may be "iconified" (that is, replaced on the desktop by a small simplified representation of itself), relocated to a distinguished area of the screen, or hidden. Combinations of these changes are also possible.
The modality of an instance may be specified using
style bits. The modality style bits are used to determine
whether input is blocked for other shells on the display.
The PRIMARY_MODAL
style allows an instance to block
input to its parent. The APPLICATION_MODAL
style
allows an instance to block input to every other shell in the
display. The SYSTEM_MODAL
style allows an instance
to block input to all shells, including shells belonging to
different applications.
Note: The styles supported by this class are treated
as HINTs, since the window manager for the
desktop on which the instance is visible has ultimate
control over the appearance and behavior of decorations
and modality. For example, some window managers only
support resizable windows and will always assume the
RESIZE style, even if it is not set. In addition, if a
modality style is not supported, it is "upgraded" to a
more restrictive modality style that is supported. For
example, if PRIMARY_MODAL
is not supported,
it would be upgraded to APPLICATION_MODAL
.
A modality style may also be "downgraded" to a less
restrictive style. For example, most operating systems
no longer support SYSTEM_MODAL
because
it can freeze up the desktop, so this is typically
downgraded to APPLICATION_MODAL
.
- Styles:
- BORDER, CLOSE, MIN, MAX, NO_MOVE, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL, SHEET
- APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL
- Events:
- Activate, Close, Deactivate, Deiconify, Iconify
Class SWT
provides two "convenience constants"
for the most commonly required style combinations:
SHELL_TRIM
-
the result of combining the constants which are required
to produce a typical application top level shell: (that
is,
CLOSE | TITLE | MIN | MAX | RESIZE
) DIALOG_TRIM
-
the result of combining the constants which are required
to produce a typical application dialog shell: (that
is,
TITLE | CLOSE | BORDER
)
Note: Only one of the styles APPLICATION_MODAL, MODELESS, PRIMARY_MODAL and SYSTEM_MODAL may be specified.
IMPORTANT: This class is not intended to be subclassed.
- See Also:
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
Fields inherited from class org.eclipse.swt.widgets.Widget
nativeZoom
-
Constructor Summary
ConstructorDescriptionShell()
Constructs a new instance of this class.Shell
(int style) Constructs a new instance of this class given only the style value describing its behavior and appearance.Constructs a new instance of this class given only the display to create it on.Constructs a new instance of this class given the display to create it on and a style value describing its behavior and appearance.Constructs a new instance of this class given only its parent.Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addShellListener
(ShellListener listener) Adds the listener to the collection of listeners who will be notified when operations are performed on the receiver, by sending the listener one of the messages defined in theShellListener
interface.void
close()
Requests that the window manager close the receiver in the same way it would be closed when the user clicks on the "close box" or performs some other platform specific key or mouse combination that indicates the window should be removed.void
If the receiver is visible, moves it to the top of the drawing order for the display on which it was created (so that all other shells on that display, which are not the receiver's children will be drawn behind it) and forces the window manager to make the shell active.int
getAlpha()
Returns the receiver's alpha value.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.boolean
Returnstrue
if the receiver is enabled, andfalse
otherwise.boolean
Returnstrue
if the receiver is currently in fullscreen state, and false otherwise.int
Returns the receiver's input method editor mode.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.boolean
Returnstrue
if the receiver is currently maximized, and false otherwise.Returns a point describing the maximum receiver's size.Returns a point describing the minimum receiver's size.boolean
Gets the receiver's modified state.Returns the region that defines the shape of the shell, ornull
if the shell has the default shape.getShell()
Returns the receiver's shell.Shell[]
Returns an array containing all shells which are descendants of the receiver.Returns a ToolBar object representing the tool bar that can be shown in the receiver's trim.static Shell
internal_new
(Display display, long handle) Invokes platform specific functionality to allocate a new shell that is not embedded.boolean
Returnstrue
if the receiver is enabled and all ancestors up to and including the receiver's nearest ancestor shell are enabled.boolean
Returnstrue
if the receiver is visible and all ancestors up to and including the receiver's nearest ancestor shell are visible.void
open()
Moves the receiver to the top of the drawing order for the display on which it was created (so that all other shells on that display, which are not the receiver's children will be drawn behind it), marks it visible, sets the focus and asks the window manager to make the shell active.boolean
Prints the receiver and all children.void
removeShellListener
(ShellListener listener) Removes the listener from the collection of listeners who will be notified when operations are performed on the receiver.void
Requests that this control and all of its ancestors be repositioned by their layouts at the earliest opportunity.void
If the receiver is visible, moves it to the top of the drawing order for the display on which it was created (so that all other shells on that display, which are not the receiver's children will be drawn behind it) and asks the window manager to make the shell activevoid
setAlpha
(int alpha) Sets the receiver's alpha value which must be between 0 (transparent) and 255 (opaque).void
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.void
Sets the receiver's size and location in points to the rectangular area specified by the argument.void
setEnabled
(boolean enabled) Enables the receiver if the argument istrue
, and disables it otherwise.void
setFullScreen
(boolean fullScreen) Sets the full screen state of the receiver.void
setImeInputMode
(int mode) Sets the input method editor mode to the argument which should be the result of bitwise OR'ing together one or more of the following constants defined in classSWT
:NONE
,ROMAN
,DBCS
,PHONETIC
,NATIVE
,ALPHA
.void
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.void
setLocation
(Point location) 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.void
setMaximumSize
(int width, int height) Sets the receiver's maximum size to the size specified by the arguments.void
setMaximumSize
(Point size) Sets the receiver's maximum size to the size specified by the argument.void
setMinimumSize
(int width, int height) Sets the receiver's minimum size to the size specified by the arguments.void
setMinimumSize
(Point size) Sets the receiver's minimum size to the size specified by the argument.void
setModified
(boolean modified) Sets the receiver's modified state as specified by the argument.void
Sets the shape of the shell to the region specified by the argument.void
setVisible
(boolean visible) Marks the receiver as visible if the argument istrue
, and marks it invisible otherwise.static Shell
Invokes platform specific functionality to allocate a new shell that is embedded.Methods inherited from class org.eclipse.swt.widgets.Decorations
checkSubclass, dispose, getDefaultButton, getImage, getImages, getMenuBar, getMinimized, getText, isReparentable, setDefaultButton, setImage, setImages, setMaximized, setMenuBar, setMinimized, setOrientation, setText
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsMode
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getCursor, getDragDetect, getFont, getForeground, getLayoutData, getMenu, getMonitor, getOrientation, getParent, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isFocusControl, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setCapture, setCursor, setDragDetect, setForeground, setLayoutData, setMenu, setParent, setRedraw, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, addTypedListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Constructor Details
-
Shell
public Shell()Constructs a new instance of this class. This is equivalent to callingShell((Display) null)
.- Throws:
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
-
Shell
public Shell(int style) Constructs a new instance of this class given only the style value describing its behavior and appearance. This is equivalent to callingShell((Display) null, style)
.The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint
"|" operator) two or more of thoseSWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.- Parameters:
style
- the style of control to construct- Throws:
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:
-
Shell
Constructs a new instance of this class given only the display to create it on. It is created with styleSWT.SHELL_TRIM
.Note: Currently, null can be passed in for the display argument. This has the effect of creating the shell on the currently active display if there is one. If there is no current display, the shell is created on a "default" display. Passing in null as the display argument is not considered to be good coding style, and may not be supported in a future release of SWT.
- Parameters:
display
- the display to create the shell on- Throws:
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
-
Shell
Constructs a new instance of this class given the display to create it on and a style value describing its behavior and appearance.The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint
"|" operator) two or more of thoseSWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.Note: Currently, null can be passed in for the display argument. This has the effect of creating the shell on the currently active display if there is one. If there is no current display, the shell is created on a "default" display. Passing in null as the display argument is not considered to be good coding style, and may not be supported in a future release of SWT.
- Parameters:
display
- the display to create the shell onstyle
- the style of control to construct- Throws:
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:
-
Shell
Constructs a new instance of this class given only its parent. It is created with styleSWT.DIALOG_TRIM
.Note: Currently, null can be passed in for the parent. This has the effect of creating the shell on the currently active display if there is one. If there is no current display, the shell is created on a "default" display. Passing in null as the parent is not considered to be good coding style, and may not be supported in a future release of SWT.
- Parameters:
parent
- a shell which will be the parent of the new instance- Throws:
IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the parent is disposed
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
-
Shell
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint
"|" operator) two or more of thoseSWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.Note: Currently, null can be passed in for the parent. This has the effect of creating the shell on the currently active display if there is one. If there is no current display, the shell is created on a "default" display. Passing in null as the parent is not considered to be good coding style, and may not be supported in a future release of SWT.
- Parameters:
parent
- a shell which will be the parent of the new instancestyle
- the style of control to construct- Throws:
IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the parent is disposed
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
-
win32_new
Invokes platform specific functionality to allocate a new shell that is embedded.IMPORTANT: This method is not part of the public API for
Shell
. 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.- Parameters:
display
- the display for the shellhandle
- the handle for the shell- Returns:
- a new shell object containing the specified display and handle
- Restriction:
- This method is not intended to be referenced by clients.
-
internal_new
Invokes platform specific functionality to allocate a new shell that is not embedded.IMPORTANT: This method is not part of the public API for
Shell
. 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.- Parameters:
display
- the display for the shellhandle
- the handle for the shell- Returns:
- a new shell object containing the specified display and handle
- Since:
- 3.3
- Restriction:
- This method is not intended to be referenced by clients.
-
addShellListener
Adds the listener to the collection of listeners who will be notified when operations are performed on the receiver, by sending the listener one of the messages defined in theShellListener
interface.- 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:
-
close
public void close()Requests that the window manager close the receiver in the same way it would be closed when the user clicks on the "close box" or performs some other platform specific key or mouse combination that indicates the window should be removed.- 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
- See Also:
-
forceActive
public void forceActive()If the receiver is visible, moves it to the top of the drawing order for the display on which it was created (so that all other shells on that display, which are not the receiver's children will be drawn behind it) and forces the window manager to make the shell active.- 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:
- 2.0
- See Also:
-
getAlpha
public int getAlpha()Returns the receiver's alpha value. The alpha value is between 0 (transparent) and 255 (opaque).- Returns:
- the alpha value
- 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
-
getEnabled
public boolean getEnabled()Description copied from class:Control
Returnstrue
if the receiver is enabled, andfalse
otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.- Overrides:
getEnabled
in classControl
- Returns:
- the receiver's enabled state
- See Also:
-
getFullScreen
public boolean getFullScreen()Returnstrue
if the receiver is currently in fullscreen state, and false otherwise.- Returns:
- the fullscreen 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
-
getImeInputMode
public int getImeInputMode()Returns the receiver's input method editor mode. This will be the result of bitwise OR'ing together one or more of the following constants defined in classSWT
:NONE
,ROMAN
,DBCS
,PHONETIC
,NATIVE
,ALPHA
.- Returns:
- the IME mode
- 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
- See Also:
-
getMaximized
public boolean getMaximized()Description copied from class:Decorations
Returnstrue
if the receiver is currently maximized, and false otherwise.- Overrides:
getMaximized
in classDecorations
- Returns:
- the maximized state
- See Also:
-
getMaximumSize
Returns a point describing the maximum receiver's size. The x coordinate of the result is the maximum width of the receiver. The y coordinate of the result is the maximum height of the receiver.- Returns:
- the receiver's size
- 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.116
-
getMinimumSize
Returns a point describing the minimum receiver's size. The x coordinate of the result is the minimum width of the receiver. The y coordinate of the result is the minimum height of the receiver.- Returns:
- the receiver's size
- 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.1
-
getModified
public boolean getModified()Gets the receiver's modified state.- Returns:
true
if the receiver is marked as modified, orfalse
otherwise- 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.5
-
getRegion
Returns the region that defines the shape of the shell, ornull
if the shell has the default shape.- Overrides:
getRegion
in classControl
- Returns:
- the region that defines the shape of the shell, or
null
- 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.0
-
getShell
Description copied from class:Control
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. -
getShells
Returns an array containing all shells which are descendants of the receiver.- Returns:
- the dialog shells
- 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
-
getToolBar
Returns a ToolBar object representing the tool bar that can be shown in the receiver's trim. This will returnnull
if the platform does not support tool bars that are not part of the content area of the shell, or if the Shell's style does not support having a tool bar.- Returns:
- a ToolBar object representing the Shell's tool bar, or
null
. - 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.7
-
isEnabled
public boolean isEnabled()Description copied from class:Control
Returnstrue
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. -
isVisible
public boolean isVisible()Description copied from class:Control
Returnstrue
if the receiver is visible and all ancestors up to and including the receiver's nearest ancestor shell are visible. Otherwise,false
is returned. -
open
public void open()Moves the receiver to the top of the drawing order for the display on which it was created (so that all other shells on that display, which are not the receiver's children will be drawn behind it), marks it visible, sets the focus and asks the window manager to make the shell active.- 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
- See Also:
-
print
Description copied from class:Control
Prints the receiver and all children. -
removeShellListener
Removes the listener from the collection of listeners who will be notified when operations are performed on the receiver.- 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:
-
requestLayout
public void requestLayout()Description copied from class:Control
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.
- Overrides:
requestLayout
in classControl
-
setActive
public void setActive()If the receiver is visible, moves it to the top of the drawing order for the display on which it was created (so that all other shells on that display, which are not the receiver's children will be drawn behind it) and asks the window manager to make the shell active- 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:
- 2.0
- See Also:
-
setAlpha
public void setAlpha(int alpha) Sets the receiver's alpha value which must be between 0 (transparent) and 255 (opaque).This operation requires the operating system's advanced widgets subsystem which may not be available on some platforms.
- Parameters:
alpha
- the alpha value- 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
-
getBounds
Description copied from class:Control
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. -
getLocation
Description copied from class:Control
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 relative to the display.- Overrides:
getLocation
in classControl
- Returns:
- the receiver's location
-
setLocation
Description copied from class:Control
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.- Overrides:
setLocation
in classControl
- Parameters:
location
- the new location for the receiver
-
setLocation
public void setLocation(int x, int y) Description copied from class:Control
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.- Overrides:
setLocation
in classControl
- Parameters:
x
- the new x coordinate for the receivery
- the new y coordinate for the receiver
-
setBounds
Description copied from class:Control
Sets the receiver's size and location in points to the rectangular area specified by the argument. Thex
andy
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.
-
setBounds
public void setBounds(int x, int y, int width, int height) Description copied from class:Control
Sets the receiver's size and location in points to the rectangular area specified by the arguments. Thex
andy
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, thex
andy
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.
-
setEnabled
public void setEnabled(boolean enabled) Description copied from class:Control
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:
setEnabled
in classControl
- Parameters:
enabled
- the new enabled state
-
setFullScreen
public void setFullScreen(boolean fullScreen) Sets the full screen state of the receiver. If the argument istrue
causes the receiver to switch to the full screen state, and if the argument isfalse
and the receiver was previously switched into full screen state, causes the receiver to switch back to either the maximized or normal states.Note: The result of intermixing calls to
setFullScreen(true)
,setMaximized(true)
,setMinimized(true)
andsetMaximumSize
will vary by platform. Typically, the behavior will match the platform user's expectations, but not always. This should be avoided if possible.- Parameters:
fullScreen
- the new fullscreen 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
-
setImeInputMode
public void setImeInputMode(int mode) Sets the input method editor mode to the argument which should be the result of bitwise OR'ing together one or more of the following constants defined in classSWT
:NONE
,ROMAN
,DBCS
,PHONETIC
,NATIVE
,ALPHA
.- Parameters:
mode
- the new IME mode- 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
- See Also:
-
setMaximumSize
public void setMaximumSize(int width, int height) Sets the receiver's maximum size to the size specified by the arguments. If the new maximum size is smaller than the current size of the receiver, the receiver is resized to the new maximum size.Note: The result of intermixing calls to
setMaximumSize
andsetFullScreen(true)
will vary by platform. Typically, the behavior will match the platform user's expectations, but not always. This should be avoided if possible.- Parameters:
width
- the new maximum width for the receiverheight
- the new maximum height for the receiver- 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.116
-
setMaximumSize
Sets the receiver's maximum size to the size specified by the argument. If the new maximum size is smaller than the current size of the receiver, the receiver is resized to the new maximum size.Note: The result of intermixing calls to
setMaximumSize
andsetFullScreen(true)
will vary by platform. Typically, the behavior will match the platform user's expectations, but not always. This should be avoided if possible.- Parameters:
size
- the new maximum size for the receiver- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the point 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
- Since:
- 3.116
-
setMinimumSize
public void setMinimumSize(int width, int height) Sets the receiver's minimum size to the size specified by the arguments. If the new minimum size is larger than the current size of the receiver, the receiver is resized to the new minimum size.- Parameters:
width
- the new minimum width for the receiverheight
- the new minimum height for the receiver- 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.1
-
setMinimumSize
Sets the receiver's minimum size to the size specified by the argument. If the new minimum size is larger than the current size of the receiver, the receiver is resized to the new minimum size.- Parameters:
size
- the new minimum size for the receiver- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the point 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
- Since:
- 3.1
-
setModified
public void setModified(boolean modified) Sets the receiver's modified state as specified by the argument.- Parameters:
modified
- the new modified state for the receiver- 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.5
-
setRegion
Sets the shape of the shell to the region specified by the argument. When the argument is null, the default shape of the shell is restored. The shell must be created with the style SWT.NO_TRIM in order to specify a region.NOTE: This method also sets the size of the shell. Clients should not call
Control.setSize(int, int)
orsetBounds(org.eclipse.swt.graphics.Rectangle)
on this shell. Furthermore, the passed region should not be modified any more.- Overrides:
setRegion
in classControl
- Parameters:
region
- the region that defines the shape of the shell (or null)- Throws:
IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the region 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
- Since:
- 3.0
-
setVisible
public void setVisible(boolean visible) Description copied from class:Control
Marks the receiver as visible if the argument istrue
, 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.
- Overrides:
setVisible
in classDecorations
- Parameters:
visible
- the new visibility state
-