Applications which are built with SWT will almost always
require only a single display. In particular, some platforms
which SWT supports will not allow more than one active
display. In other words, some platforms do not support
creating a new display if one already exists that has not been
sent the dispose() message.
In SWT, the thread which creates a Display
instance is distinguished as the user-interface thread
for that display.
Widget and its subclasses), may only be called
from the thread. (To support multi-threaded user-interface
applications, class Display provides inter-thread
communication methods which allow threads other than the
user-interface thread to request that it perform operations
on their behalf.)
Displays until that display has been disposed.
(Note that, this is in addition to the restriction mentioned
above concerning platform support for multiple displays. Thus,
the only way to have multiple simultaneously active displays,
even on platforms which support it, is to have multiple threads.)
Enforcing these attributes allows SWT to be implemented directly on the underlying operating system's event model. This has numerous benefits including smaller footprint, better use of resources, safer memory management, clearer program logic, better performance, and fewer overall operating system threads required. The down side however, is that care must be taken (only) when constructing multi-threaded applications to use the inter-thread communication mechanisms which this class provides when required.
All SWT API methods which may only be called from the user-interface
thread are distinguished in their documentation by indicating that
they throw the "ERROR_THREAD_INVALID_ACCESS"
SWT exception.
Important Note
This class is not intended to be subclassed.
syncExec, asyncExec, wake, readAndDispatch, sleep, Device#dispose, Display snippets, Sample code and further information
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Callback | |
| pack-priv long | |
| pack-priv boolean | |
| pack-priv Shell | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv int | |
| pack-priv static String | |
| pack-priv static String | |
| pack-priv int | |
| pack-priv Callback | |
| pack-priv int | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv int | |
| pack-priv long[] | |
| pack-priv int[] | |
| pack-priv long[] | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv ArrayList | |
| private static final Pattern | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv Caret | |
| pack-priv Control | |
| pack-priv TrayItem | |
| pack-priv Cursor[] | |
| pack-priv Object | |
| pack-priv static Display | |
| pack-priv static final String | |
| pack-priv int[] | |
| pack-priv static Display[] | |
| pack-priv Runnable[] | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv boolean | |
| pack-priv Consumer | |
| pack-priv Image | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv Event[] | |
| pack-priv EventTable | |
| pack-priv XExposeEvent | |
| pack-priv static final String | |
| pack-priv boolean | |
| pack-priv long | |
| pack-priv EventTable | |
| pack-priv static long | |
| pack-priv boolean | |
| pack-priv long[] | |
| pack-priv GdkRectangle | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv Control | |
| pack-priv int | |
| pack-priv long | |
| pack-priv int | |
| pack-priv int | |
| pack-priv long[] | |
| pack-priv Widget[] | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv Map | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv Callback | |
| pack-priv int | |
| pack-priv Object | |
| pack-priv boolean | |
| pack-priv long | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv long | |
| pack-priv Control | |
| pack-priv int[] | |
| pack-priv Image | |
| pack-priv static final int | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv String[] | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv static final int[][] | |
| private static final int | |
| pack-priv int | |
| pack-priv long | |
| pack-priv int | |
| pack-priv Widget | |
| private int | |
| pack-priv Composite[] | |
| pack-priv int | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv int[] | |
| pack-priv Control | |
| pack-priv Dialog | |
| pack-priv Shell[] | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv int | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv static final String | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv Menu[] | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv Image | |
| pack-priv static final String | |
| pack-priv static Callback | |
| pack-priv static long | |
| pack-priv static Callback | |
| pack-priv static long | |
| pack-priv static Callback | |
| pack-priv static long | |
| pack-priv static Callback | |
| pack-priv static long | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv Callback | |
| pack-priv double | |
| pack-priv double | |
| pack-priv int | |
| pack-priv long | |
| pack-priv static final int | |
| pack-priv Resource[] | |
| pack-priv boolean | |
| pack-priv Consumer | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv SessionManagerDBus | |
| pack-priv Display. | |
| pack-priv static final String | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv boolean | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv int[] | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv int | |
| pack-priv Widget[] | |
| private static final int | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv static boolean | |
| pack-priv static final int | |
| pack-priv final int | |
| pack-priv final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv Synchronizer | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static boolean | themeDark
True if the current theme is dark. |
| pack-priv static String | themeName
The name of the current theme, including the theme named by GTK_THEME. |
| pack-priv Thread | |
| pack-priv int[] | |
| pack-priv Callback | |
| pack-priv int[] | |
| pack-priv Runnable[] | |
| pack-priv long | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv Tracker | |
| pack-priv Tray | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv int[] | |
| pack-priv int[] | |
| pack-priv Object[] | |
| pack-priv boolean | |
| pack-priv Image | |
| pack-priv Widget[] | |
| pack-priv Callback | |
| pack-priv long | |
| pack-priv Callback | |
| pack-priv Callback | |
| pack-priv Callback | |
| pack-priv Callback | |
| pack-priv Callback | |
| pack-priv String | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv boolean | |
| pack-priv Callback | |
| pack-priv long |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static int | |
| pack-priv void | |
| public void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public void | addListener(int
the type of event to listen for eventType, Listener the listener which should be notified when the event occurs listener)Adds the listener to the collection of listeners who will be notified when an event of the given type occurs. |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv long | |
| public void | |
| public void | |
| pack-priv long | |
| pack-priv long | |
| pack-priv boolean | |
| pack-priv boolean | Returns: true if the current theme is darkthe full name of the current theme SWT is running with themeName)Sets the org.eclipse.swt.internal.gtk.theme value with the current GTK theme name. |
| protected void | checkDevice()
Overrides org. SWTException if the receiver can not
be accessed by the caller.
|
| pack-priv static void | |
| pack-priv long | |
| pack-priv void | checkIMModule()
Check if the XIM module is present and generates a warning for potential graphical issues if GTK_IM_MODULE=xim is detected. |
| protected void | |
| pack-priv void | |
| public void | |
| pack-priv void | |
| pack-priv GdkRGBA | |
| protected void | create(DeviceData
the DeviceData which describes the receiver data)Overrides org. |
| pack-priv void | |
| pack-priv Image | |
| pack-priv String | |
| pack-priv static void | |
| protected void | destroy()
Overrides org. |
| pack-priv void | |
| public void | disposeExec(Runnable
code to run at dispose time. runnable)Causes the |
| pack-priv void | |
| pack-priv String | |
| pack-priv long | |
| pack-priv void | |
| pack-priv void | error(int
the descriptive error code code)Does whatever display specific cleanup is required, and then
uses the code in |
| pack-priv long | |
| public void | execute(Runnable
the runnable to execute in the user-interface thread, never
runnable)nullImplements java. |
| public static String | Returns: a String representing the error message that was setpointer to the GError errorPtr)Helper method to extract GError messages. |
| pack-priv boolean | |
| pack-priv boolean | |
| public static Display | Returns: the display for the given threadthe user-interface thread thread)Returns the display which the given thread is the user-interface thread for, or null if the given thread is not a user-interface thread for any display. |
| pack-priv long | |
| private int | Returns: the most Latin keyboard layout group (i.e. group holding the max number of Latin alphabet keys)Determine key group of Latin layout, and update the layout group to key count map. |
| public Widget | Returns: the SWT widget that the handle representsthe handle for the widget handle)Given the operating system handle for a widget, returns
the instance of the |
| public Widget | Returns: the SWT widget that the handle/id pair representsthe handle for the widget handle, long the id for the subwidget (usually an item) id)Given the operating system handle for a widget,
and widget-specific id, returns the instance of
the |
| public Widget | Returns: the SWT subwidget (usually an item) that the widget/id pair representsthe widget widget, long the id for the subwidget (usually an item) id)Given a widget and a widget-specific id, returns the
instance of the |
| pack-priv void | |
| pack-priv void | |
| private void | |
| pack-priv long | |
| pack-priv long | |
| pack-priv void | |
| public Shell | Returns: the active shell or nullReturns the currently active |
| public static String | |
| public static String | |
| public Rectangle | Returns: the bounding rectangleOverrides org. |
| pack-priv Rectangle | |
| pack-priv int | |
| public Rectangle | Returns: the client area |
| pack-priv long | |
| public static Display | Returns: the current displayReturns the display which the currently running thread is the user-interface thread for, or null if the currently running thread is not a user-interface thread for any display. |
| public Control | Returns: the control under the cursor ornullReturns the control which the on-screen pointer is currently over top of, or null if it is not currently over one of the controls built by the currently running application. |
| public Point | Returns: the cursor locationReturns the location of the on-screen pointer relative to the top left corner of the screen. |
| pack-priv Point | |
| public Point[] | Returns: the array of cursor sizesReturns an array containing the recommended cursor sizes. |
| public Object | |
| public Object | Returns: the display specific dataReturns the application defined, display specific data associated with the receiver, or null if it has not been set. |
| public static Display | |
| public int | getDepth()
Overrides org. |
| public int | Returns: the button dismissal orderReturns the button dismissal alignment, one of |
| public int | Returns: the double click timeReturns the longest duration, in milliseconds, between two mouse button clicks that will be considered a double click by the underlying operating system. |
| public final Consumer | Returns: the current error handler. Nevernull.Returns the current exception handler. |
| public Control | Returns: the focus control ornullReturns the control which currently has keyboard focus, or null if keyboard events are not currently going to any of the controls built by the currently running application. |
| pack-priv Map | getGroupKeysCount()
Return a mapping from layout group to the number of Latin alphabet (a-z) in each group |
| public boolean | Returns: the high contrast modeReturns true when the high contrast mode is enabled. |
| public int | Returns: the maximum icon depthReturns the maximum allowed depth of icons on this display, in bits per pixel. |
| public Point[] | Returns: the array of icon sizesReturns an array containing the recommended icon sizes. |
| pack-priv int | |
| pack-priv int | |
| public Menu | Returns: the application menu bar, ornullReturns the single instance of the application menu bar, or
|
| pack-priv Dialog | |
| public Monitor[] | |
| pack-priv void | getPointerPosition(double[] x, double[] y)
Gets the current cursor position relative to the upper left corner of the surface. |
| public Monitor | |
| public final Consumer | Returns: the current exception handler. Nevernull.Returns the current exception handler. |
| public Shell[] | Returns: the receiver's shellsReturns a (possibly empty) array containing all shells which have not been disposed and have the receiver as their display. |
| public Synchronizer | |
| public Thread | Returns: the receiver's sync-interface threadReturns the thread that has invoked |
| public Color | Returns: the matching colorthe color constant id)Overrides org. SWT.
|
| public Cursor | Returns: the corresponding cursor ornullthe SWT cursor constant id)Returns the matching standard platform cursor for the given
constant, which should be one of the cursor constants
specified in class |
| public Image | Returns: the corresponding image ornullthe SWT icon constant id)Returns the matching standard platform image for the given
constant, which should be one of the icon constants
specified in class |
| public Menu | Returns: the system menu, ornullReturns the single instance of the system-provided menu for the application, or
|
| public TaskBar | Returns: the system taskBar ornullReturns the single instance of the system taskBar or null when there is no system taskBar available for the platform. |
| public Tray | Returns: the system tray ornullReturns the single instance of the system tray or null when there is no system tray available for the platform. |
| public Thread | Returns: the receiver's user-interface threadReturns the user-interface thread for the receiver. |
| public boolean | Returns: true if a touch-aware input device is detected, or false otherwiseReturns a boolean indicating whether a touch-aware input device is attached to the system and is ready for use. |
| pack-priv Widget | |
| pack-priv long | Returns: the cursor position to x & y. Return value of the function is the window pointer underneath the cursor, can be NULL.Gets the current cursor position relative to the upper left corner of the window. |
| pack-priv Rectangle | getWorkArea()
Returns the work area, an EWMH property to store the size and position of the screen not covered by dock and panel windows. |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv String | |
| pack-priv GdkRGBA | Returns: a GdkRGBA object representing the background color, or COLOR_WIDGET_BACKGROUND if the background color could not be parsed or isn't seta CSS being parsed css, String a String representation of a selector to search for, or NULL if
the entire GtkCssProvider is to be parsed precise)This method allows for parsing of background colors from a GTK CSS string. |
| pack-priv GdkRGBA | Returns: a GdkRGBA object representing the foreground color or COLOR_WIDGET_FOREGROUND if the foreground color could not be parsed or isn't seta CSS representation of the gtk theme css, String a String representation of a selector to search for, or NULL if
the entire GtkCssProvider is to be parsed precise)This method allows for parsing of foreground colors from a GTK CSS string. |
| pack-priv GdkRGBA | Returns: a GdkRGBA object representing the color, or transparent (empty GdkRGBA) if the color could not be parseda String representation of the color property)This method parses a string representation of a color and returns a GdkRGBA object of that color. |
| pack-priv String | |
| pack-priv long | |
| pack-priv String | Returns: a String representation of the color or COLOR_WIDGET_BACKGROUND if NULL is specified as a parametera GdkRGBA object containing the color to be parsed
or NULL rgba)In GdkRGBA, values are a double between 0-1. |
| pack-priv String | Returns: a String representation of the widget's CSS namea pointer to the GtkWidget resource handle)Gets the CSS name of the widget provided. |
| pack-priv String | Returns: a String representation of the widget's namea pointer to the GtkWidget resource handle)Gets the name of the widget in String format. |
| pack-priv long | |
| protected void | init()
Overrides org. |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| private void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public void | internal_dispose_GC(long
the platform specific GC handle hDC, GCData the platform specific GC data data)Implements abstract org. Implements org. |
| public long | Returns: the platform specific GC handlethe platform specific GC data data)Implements abstract org. Implements org. |
| pack-priv static int | inversePremultipliedColor(int color, int alpha)
Calculates original color from RGBA with premultiplied alpha. |
| pack-priv static boolean | |
| public static boolean | Returns: true if the current OS theme has a dark appearance, else
returns false.Returns |
| pack-priv static boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv long | |
| pack-priv void | |
| public Point | |
| public Point | |
| public Rectangle | |
| public Rectangle | Returns: rectangle with mapped coordinatesthe source from, Control Control or nullthe destination to, int Control or nullcoordinates to be mapped x, int coordinates to be mapped y, int coordinates to be mapped width, int coordinates to be mapped height)Maps a point from one coordinate system to another. |
| pack-priv Point | |
| pack-priv Rectangle | |
| pack-priv Rectangle | |
| pack-priv long | |
| pack-priv long | |
| public boolean | |
| pack-priv void | |
| pack-priv void | |
| public boolean | Returns: false if the caller can sleep upon return from this methodReads an event from the operating system's event queue,
dispatches it appropriately, and returns |
| pack-priv static void | |
| protected void | release()
Overrides org. |
| pack-priv void | |
| pack-priv void | |
| public void | removeFilter(int
the type of event to listen for eventType, Listener the listener which should no longer be notified when the event occurs listener)Removes the listener from the collection of listeners who will be notified when an event of the given type occurs anywhere in a widget. |
| pack-priv long | |
| pack-priv void | |
| public void | removeListener(int
the type of event to listen for eventType, Listener the listener which should no longer be notified listener)Removes the listener from the collection of listeners who will be notified when an event of the given type occurs. |
| pack-priv void | |
| pack-priv void | |
| pack-priv Widget | |
| private static void | renderAllBackgrounds(long styleContext, long cairo)
What user sees is a combination of multiple layers. |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static long | rendererRenderProc(long cell, long cr, long handle, long background_area, long cell_area, long flags)
|
| pack-priv static long | rendererSnapshotProc(long cell, long snapshot, long handle, long background_area, long cell_area, long flags)
|
| pack-priv void | |
| pack-priv void | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv void | |
| pack-priv boolean | |
| pack-priv void | |
| pack-priv void | |
| private void | |
| private void | |
| pack-priv void | |
| public void | |
| pack-priv void | |
| public void | |
| public static void | |
| public static void | |
| pack-priv void | |
| public void | setCursorLocation(int
the new x coordinate for the cursor x, int the new y coordinate for the cursor y)Sets the location of the on-screen pointer relative to the top left corner of the screen. |
| public void | setCursorLocation(Point
new position point)Sets the location of the on-screen pointer relative to the top left corner of the screen. |
| pack-priv void | |
| public void | |
| public void | |
| pack-priv static void | |
| pack-priv long | |
| public final void | setErrorHandler(Consumer<Error>
new error handler to be registered. errorHandler)Sets a callback that will be invoked whenever an error is thrown by a listener or external callback function. |
| pack-priv void | |
| pack-priv void | |
| public final void | setRuntimeExceptionHandler(Consumer<RuntimeException>
new exception handler to be registered. runtimeExceptionHandler)Sets a callback that will be invoked whenever an exception is thrown by a listener or external callback function. |
| public void | setSynchronizer(Synchronizer
the new synchronizer for the display (must not be null) synchronizer)Sets the synchronizer used by the display to be the argument, which can not be null. |
| pack-priv long | |
| pack-priv void | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| public boolean | Returns: true if an event requiring dispatching was placed on the queue.Causes the user-interface thread to sleep (that is, to be put in a state where it does not consume CPU cycles) until an event is received or it is otherwise awakened. |
| pack-priv void | |
| pack-priv GdkRGBA | styleContextEstimateBackgroundColor(long context, int state)
Background in GTK theme can be more complex then just solid color: 1) Due to 'background-image', 'background-position', 'background-repeat', etc. Example: 'tooltip' in 'Ambiance' theme uses 'background-image'. |
| pack-priv GdkRGBA | |
| public <T, E extends Exception> T | syncCall(SwtCallable<T, E>
the code to call on the user-interface thread callable)Calls the callable on the user-interface thread at the next reasonable opportunity, and returns the its result from this method. |
| public void | |
| public void | |
| pack-priv long | |
| pack-priv GdkRGBA | Returns: GdkRGBA object with calculated RGB valuesthe source GdkRGBA from which RGB values are copied from rgba, double a value between 0 and Double.MAX_VALUE which modifies the brightness of saturation and luminosity brightness)This method converts from RGB to HSV, from HSV to HSL (including brightness), from HSL back to HSV and from HSV back to RGB. |
| pack-priv static int | |
| pack-priv static int | |
| public void | update()
Forces all outstanding paint requests for the display to be processed before this method returns. |
| public void | wake()
If the receiver's user-interface thread was |
| pack-priv void | |
| pack-priv void | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long |