org.eclipse.swt.widgets
Class Shell

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.swt.widgets.Canvas
                      extended by org.eclipse.swt.widgets.Decorations
                          extended by org.eclipse.swt.widgets.Shell
All Implemented Interfaces:
Drawable

public class Shell
extends Decorations

Instances of this class represent the "windows" which the desktop or "window manager" is managing. Instances that do not have a parent (that is, they are built using the constructor, which takes a 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:

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_TRIM, RESIZE, TITLE, ON_TOP, TOOL
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:
Decorations, SWT, Shell snippets, SWT Example: ControlExample, Sample code and further information

Field Summary
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
Shell()
          Constructs a new instance of this class.
Shell(Display display)
          Constructs a new instance of this class given only the display to create it on.
Shell(Display display, int style)
          Constructs a new instance of this class given the display to create it on and a style value describing its behavior and appearance.
Shell(int style)
          Constructs a new instance of this class given only the style value describing its behavior and appearance.
Shell(Shell parent)
          Constructs a new instance of this class given only its parent.
Shell(Shell parent, int style)
          Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
 
Method Summary
 void 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 the ShellListener 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.
 Rectangle computeTrim(int x, int y, int width, int height)
          Given a desired client area for the receiver (as described by the arguments), returns the bounding rectangle which would be required to produce that client area.
 void dispose()
          Disposes of the operating system resources associated with the receiver and all its descendants.
 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.
 int getAlpha()
          Returns the receiver's alpha value.
 Rectangle getBounds()
          Returns a rectangle describing the receiver's size and location relative to its parent (or its display if its parent is null), unless the receiver is a shell.
 boolean getFullScreen()
          Returns true if the receiver is currently in fullscreen state, and false otherwise.
 int getImeInputMode()
          Returns the receiver's input method editor mode.
 Point getLocation()
          Returns a point describing the receiver's location relative to its parent (or its display if its parent is null), unless the receiver is a shell.
 boolean getMaximized()
          Returns true if the receiver is currently maximized, and false otherwise.
 Point getMinimumSize()
          Returns a point describing the minimum receiver's size.
 Region getRegion()
          Returns the region that defines the shape of the shell, or null if the shell has the default shape.
 Shell[] getShells()
          Returns an array containing all shells which are descendants of the receiver.
 Point getSize()
          Returns a point describing the receiver's size.
 boolean getVisible()
          Returns true if the receiver is visible, and false otherwise.
static Shell gtk_new(Display display, long handle)
           
static Shell internal_new(Display display, long handle)
          Invokes platform specific functionality to allocate a new shell that is not embedded.
 boolean isEnabled()
          Returns true if the receiver is enabled and all ancestors up to and including the receiver's nearest ancestor shell are enabled.
 boolean isVisible()
          Returns true 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 print(GC gc)
          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 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
 void setAlpha(int alpha)
          Sets the receiver's alpha value which must be between 0 (transparent) and 255 (opaque).
 void setEnabled(boolean enabled)
          Enables the receiver if the argument is true, 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 class SWT: NONE, ROMAN, DBCS, PHONETIC, NATIVE, ALPHA.
 void setMaximized(boolean maximized)
          Sets the maximized state of the receiver.
 void setMenuBar(Menu menu)
          Sets the receiver's menu bar to the argument, which may be null.
 void setMinimized(boolean minimized)
          Sets the minimized stated of the receiver.
 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 setRegion(Region region)
          Sets the shape of the shell to the region specified by the argument.
 void setText(java.lang.String string)
          Sets the receiver's text, which is the string that the window manager will typically display as the receiver's title, to the argument, which must not be null.
 void setVisible(boolean visible)
          Marks the receiver as visible if the argument is true, and marks it invisible otherwise.
 
Methods inherited from class org.eclipse.swt.widgets.Decorations
checkSubclass, getDefaultButton, getImage, getImages, getMenuBar, getMinimized, getText, isReparentable, setDefaultButton, setImage, setImages
 
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, computeSize, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
getBorderWidth, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getMenu, getMonitor, getParent, getShell, getToolTipText, internal_dispose_GC, internal_new_GC, isFocusControl, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Shell

public Shell()
Constructs a new instance of this class. This is equivalent to calling Shell((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 calling Shell((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 the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

Parameters:
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:
SWT.BORDER, SWT.CLOSE, SWT.MIN, SWT.MAX, SWT.RESIZE, SWT.TITLE, SWT.NO_TRIM, SWT.SHELL_TRIM, SWT.DIALOG_TRIM, SWT.MODELESS, SWT.PRIMARY_MODAL, SWT.APPLICATION_MODAL, SWT.SYSTEM_MODAL

Shell

public Shell(Display display)
Constructs a new instance of this class given only the display to create it on. It is created with style SWT.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

public Shell(Display display,
             int style)
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 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.

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
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:
SWT.BORDER, SWT.CLOSE, SWT.MIN, SWT.MAX, SWT.RESIZE, SWT.TITLE, SWT.NO_TRIM, SWT.SHELL_TRIM, SWT.DIALOG_TRIM, SWT.MODELESS, SWT.PRIMARY_MODAL, SWT.APPLICATION_MODAL, SWT.SYSTEM_MODAL

Shell

public Shell(Shell parent)
Constructs a new instance of this class given only its parent. It is created with style SWT.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:
java.lang.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

public Shell(Shell 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.

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
style - the style of control to construct
Throws:
java.lang.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:
SWT.BORDER, SWT.CLOSE, SWT.MIN, SWT.MAX, SWT.RESIZE, SWT.TITLE, SWT.NO_TRIM, SWT.SHELL_TRIM, SWT.DIALOG_TRIM, SWT.ON_TOP, SWT.TOOL, SWT.MODELESS, SWT.PRIMARY_MODAL, SWT.APPLICATION_MODAL, SWT.SYSTEM_MODAL
Method Detail

gtk_new

public static Shell gtk_new(Display display,
                            long handle)

internal_new

public static Shell internal_new(Display display,
                                 long handle)
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 shell
handle - the handle for the shell
Returns:
a new shell object containing the specified display and handle
Since:
3.3

addShellListener

public void 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 the ShellListener interface.

Parameters:
listener - the listener which should be notified
Throws:
java.lang.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:
ShellListener, removeShellListener(org.eclipse.swt.events.ShellListener)

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:
SWT.Close, dispose()

computeTrim

public Rectangle computeTrim(int x,
                             int y,
                             int width,
                             int height)
Description copied from class: Scrollable
Given a desired client area for the receiver (as described by the arguments), returns the bounding rectangle which would be required to produce that client area.

In other words, it returns a rectangle such that, if the receiver's bounds were set to that rectangle, the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings") would be the rectangle described by the arguments (relative to the receiver's parent).

Overrides:
computeTrim in class Scrollable
Parameters:
x - the desired x coordinate of the client area
y - the desired y coordinate of the client area
width - the desired width of the client area
height - the desired height of the client area
Returns:
the required bounds to produce the given client area
See Also:
Scrollable.getClientArea()

isEnabled

public boolean isEnabled()
Description copied from class: Control
Returns 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.

Overrides:
isEnabled in class Control
Returns:
the receiver's enabled state
See Also:
Control.getEnabled()

isVisible

public boolean isVisible()
Description copied from class: Control
Returns 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.

Overrides:
isVisible in class Control
Returns:
the receiver's visibility state
See Also:
Control.getVisible()

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

getFullScreen

public boolean getFullScreen()
Returns true 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

getLocation

public Point getLocation()
Description copied from class: Control
Returns a point describing the receiver's location relative to its 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:
getLocation in class Control
Returns:
the receiver's location

getMaximized

public boolean getMaximized()
Description copied from class: Decorations
Returns true if the receiver is currently maximized, and false otherwise.

Overrides:
getMaximized in class Decorations
Returns:
the maximized state
See Also:
Decorations.setMaximized(boolean)

getMinimumSize

public Point 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

getSize

public Point getSize()
Description copied from class: Control
Returns a point describing the receiver's size. The x coordinate of the result is the width of the receiver. The y coordinate of the result is the height of the receiver.

Overrides:
getSize in class Control
Returns:
the receiver's size

getVisible

public boolean getVisible()
Description copied from class: Control
Returns 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.

Overrides:
getVisible in class Control
Returns:
the receiver's visibility state

getRegion

public Region getRegion()
Returns the region that defines the shape of the shell, or null if the shell has the default shape.

Overrides:
getRegion in class Control
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

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 class SWT: 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:
SWT

getShells

public Shell[] 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

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:
Control.moveAbove(org.eclipse.swt.widgets.Control), Control.setFocus(), Control.setVisible(boolean), Display.getActiveShell(), Decorations.setDefaultButton(Button), setActive(), forceActive()

print

public boolean print(GC gc)
Description copied from class: Control
Prints the receiver and all children.

Overrides:
print in class Control
Parameters:
gc - the gc where the drawing occurs
Returns:
true if the operation was successful and false otherwise

removeShellListener

public void removeShellListener(ShellListener listener)
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:
java.lang.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:
ShellListener, addShellListener(org.eclipse.swt.events.ShellListener)

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:
Control.moveAbove(org.eclipse.swt.widgets.Control), Control.setFocus(), Control.setVisible(boolean), Display.getActiveShell(), Decorations.setDefaultButton(Button), open(), setActive()

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

setEnabled

public void setEnabled(boolean enabled)
Description copied from class: Control
Enables the receiver if the argument is true, and disables it otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.

Overrides:
setEnabled in class Control
Parameters:
enabled - the new enabled state

setFullScreen

public void setFullScreen(boolean fullScreen)
Sets the full screen state of the receiver. If the argument is true causes the receiver to switch to the full screen state, and if the argument is false and the receiver was previously switched into full screen state, causes the receiver to switch back to either the maximmized or normal states.

Note: The result of intermixing calls to setFullScreen(true), setMaximized(true) and setMinimized(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:
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 class SWT: 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:
SWT

setMaximized

public void setMaximized(boolean maximized)
Description copied from class: Decorations
Sets the maximized state of the receiver. If the argument is true causes the receiver to switch to the maximized state, and if the argument is false and the receiver was previously maximized, causes the receiver to switch back to either the minimized or normal states.

Note: The result of intermixing calls to setMaximized(true) and setMinimized(true) will vary by platform. Typically, the behavior will match the platform user's expectations, but not always. This should be avoided if possible.

Overrides:
setMaximized in class Decorations
Parameters:
maximized - the new maximized state
See Also:
Decorations.setMinimized(boolean)

setMenuBar

public void setMenuBar(Menu menu)
Description copied from class: Decorations
Sets the receiver's menu bar to the argument, which may be null.

Overrides:
setMenuBar in class Decorations
Parameters:
menu - the new menu bar

setMinimized

public void setMinimized(boolean minimized)
Description copied from class: Decorations
Sets the minimized stated of the receiver. If the argument is true causes the receiver to switch to the minimized state, and if the argument is false and the receiver was previously minimized, causes the receiver to switch back to either the maximized or normal states.

Note: The result of intermixing calls to setMaximized(true) and setMinimized(true) will vary by platform. Typically, the behavior will match the platform user's expectations, but not always. This should be avoided if possible.

Overrides:
setMinimized in class Decorations
Parameters:
minimized - the new maximized state
See Also:
Decorations.setMaximized(boolean)

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 receiver
height - 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

public void setMinimumSize(Point size)
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:
java.lang.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

setRegion

public void setRegion(Region region)
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.

Overrides:
setRegion in class Control
Parameters:
region - the region that defines the shape of the shell (or null)
Throws:
java.lang.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

setText

public void setText(java.lang.String string)
Description copied from class: Decorations
Sets the receiver's text, which is the string that the window manager will typically display as the receiver's title, to the argument, which must not be null.

Overrides:
setText in class Decorations
Parameters:
string - the new text

setVisible

public void setVisible(boolean visible)
Description copied from class: Control
Marks 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.

Overrides:
setVisible in class Control
Parameters:
visible - the new visibility state

dispose

public void dispose()
Description copied from class: Widget
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.

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.

Overrides:
dispose in class Widget
See Also:
Widget.addDisposeListener(org.eclipse.swt.events.DisposeListener), Widget.removeDisposeListener(org.eclipse.swt.events.DisposeListener), Widget.checkWidget()

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:
Control.moveAbove(org.eclipse.swt.widgets.Control), Control.setFocus(), Control.setVisible(boolean), Display.getActiveShell(), Decorations.setDefaultButton(Button), open(), setActive()

getBounds

public Rectangle getBounds()
Description copied from class: Control
Returns a rectangle describing the receiver's size and location 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.

Overrides:
getBounds in class Control
Returns:
the receiver's bounding rectangle