Constructs a new instance of this class. <p> Note: The resulting display is marked as the <em>current</em> display. If this is the first display which has been constructed since the application started, it is also marked as the <em>default</em> display. </p>
Constructs a new instance of this class using the parameter.
Adds the listener to the collection of listeners who will be notified when an event of the given type occurs anywhere in a widget. The event type is one of the event constants defined in class <code>SWT</code>. When the event does occur, the listener is notified by sending it the <code>handleEvent()</code> message. <p> Setting the type of an event to <code>SWT.None</code> from within the <code>handleEvent()</code> method can be used to change the event type and stop subsequent Java listeners from running. Because event filters run before other listeners, event filters can both block other listeners and set arbitrary fields within an event. For this reason, event filters are both powerful and dangerous. They should generally be avoided for performance, debugging and code maintenance reasons. </p>
Adds the listener to the collection of listeners who will be notified when an event of the given type occurs. The event type is one of the event constants defined in class <code>SWT</code>. When the event does occur in the display, the listener is notified by sending it the <code>handleEvent()</code> message.
Causes the <code>run()</code> method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity. The caller of this method continues to run in parallel, and is not notified when the runnable has completed. Specifying <code>null</code> as the runnable simply wakes the user-interface thread when run. <p> Note that at the time the runnable is invoked, widgets that have the receiver as their display may have been disposed. Therefore, it is necessary to check for this case inside the runnable before accessing the widget. </p>
Causes the system hardware to emit a short sound (if it supports this capability).
Checks that this class can be subclassed. <p> IMPORTANT: See the comment in <code>Widget.checkSubclass()</code>. </p>
Requests that the connection between SWT and the underlying operating system be closed.
Creates the device in the operating system. If the device does not have a handle, this method may do nothing depending on the device. <p> This method is called before <code>init</code>. </p>
Destroys the device in the operating system and releases the device's handle. If the device does not have a handle, this method may do nothing depending on the device. <p> This method is called after <code>release</code>. </p> @see Device#dispose @see #release
Causes the <code>run()</code> method of the runnable to be invoked by the user-interface thread just before the receiver is disposed. Specifying a <code>null</code> runnable is ignored.
Does whatever display specific cleanup is required, and then uses the code in <code>SWTError.error</code> to handle the error.
Given the operating system handle for a widget, returns the instance of the <code>Widget</code> subclass which represents it in the currently running application, if such exists, or null if no matching widget can be found. <p> <b>IMPORTANT:</b> This method should not be called from application code. The arguments are platform-specific. </p>
Given the operating system handle for a widget, and widget-specific id, returns the instance of the <code>Widget</code> subclass which represents the handle/id pair in the currently running application, if such exists, or null if no matching widget can be found. <p> <b>IMPORTANT:</b> This method should not be called from application code. The arguments are platform-specific. </p>
Given a widget and a widget-specific id, returns the instance of the <code>Widget</code> subclass which represents the widget/id pair in the currently running application, if such exists, or null if no matching widget can be found.
Returns the currently active <code>Shell</code>, or null if no shell belonging to the currently running application is active.
Returns a rectangle describing the receiver's size and location. Note that on multi-monitor systems the origin can be negative.
Returns 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.
Returns the location of the on-screen pointer relative to the top left corner of the screen.
Returns an array containing the recommended cursor sizes.
Returns a point whose x coordinate is the horizontal dots per inch of the display, and whose y coordinate is the vertical dots per inch of the display.
Returns the application defined property of the receiver with the specified name, or null if it has not been set. <p> Applications may have associated arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the display is disposed of, it is the application's responsibility to provide a <code>disposeExec()</code> handler which does so. </p>
Returns the application defined, display specific data associated with the receiver, or null if it has not been set. The <em>display specific data</em> is a single, unnamed field that is stored with every display. <p> Applications may put arbitrary objects in this field. If the object stored in the display specific data needs to be notified when the display is disposed of, it is the application's responsibility to provide a <code>disposeExec()</code> handler which does so. </p>
Returns the button dismissal alignment, one of <code>LEFT</code> or <code>RIGHT</code>. The button dismissal alignment is the ordering that should be used when positioning the default dismissal button for a dialog. For example, in a dialog that contains an OK and CANCEL button, on platforms where the button dismissal alignment is <code>LEFT</code>, the button ordering should be OK/CANCEL. When button dismissal alignment is <code>RIGHT</code>, the button ordering should be CANCEL/OK.
Returns the longest duration, in milliseconds, between two mouse button clicks that will be considered a <em>double click</em> by the underlying operating system.
Returns 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.
Returns true when the high contrast mode is enabled. Otherwise, false is returned. <p> Note: This operation is a hint and is not supported on platforms that do not have this concept. </p>
Returns the maximum allowed depth of icons on this display, in bits per pixel. On some platforms, this may be different than the actual depth of the display.
Returns an array containing the recommended icon sizes.
Returns an array of monitors attached to the device.
Returns the primary monitor for that device.
Returns a (possibly empty) array containing all shells which have not been disposed and have the receiver as their display.
Returns the thread that has invoked <code>syncExec</code> or null if no such runnable is currently being invoked by the user-interface thread. <p> Note: If a runnable invoked by asyncExec is currently running, this method will return null. </p>
Gets the synchronizer used by the display.
Returns the matching standard color for the given constant, which should be one of the color constants specified in class <code>SWT</code>. Any value other than one of the SWT color constants which is passed in will result in the color black. This color should not be free'd because it was allocated by the system, not the application.
Returns the matching standard platform cursor for the given constant, which should be one of the cursor constants specified in class <code>SWT</code>. This cursor should not be free'd because it was allocated by the system, not the application. A value of <code>null</code> will be returned if the supplied constant is not an SWT cursor constant.
Returns a reasonable font for applications to use. On some platforms, this will match the "default font" or "system font" if such can be found. This font should not be free'd because it was allocated by the system, not the application. <p> Typically, applications which want the default look should simply not set the font on the widgets they create. Widgets are always created with the correct default font for the class of user-interface component they represent. </p>
Returns the matching standard platform image for the given constant, which should be one of the icon constants specified in class <code>SWT</code>. This image should not be free'd because it was allocated by the system, not the application. A value of <code>null</code> will be returned either if the supplied constant is not an SWT icon constant or if the platform does not define an image that corresponds to the constant.
Returns the single instance of the system tray or null when there is no system tray available for the platform.
Returns the user-interface thread for the receiver.
Returns the work area, an EWMH property to store the size and position of the screen not covered by dock and panel windows. See http://freedesktop.org/Standards/wm-spec.
Initializes any internal resources needed by the device. <p> This method is called after <code>create</code>. </p>
Invokes platform specific functionality to dispose a GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Display</code>. 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. </p>
Invokes platform specific functionality to allocate a new GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Display</code>. 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. </p>
Maps a point from one coordinate system to another. When the control is null, coordinates are mapped to the display. <p> NOTE: On right-to-left platforms where the coordinate systems are mirrored, special care needs to be taken when mapping coordinates from one control to another to ensure the result is correctly mirrored.
Maps a point from one coordinate system to another. When the control is null, coordinates are mapped to the display. <p> NOTE: On right-to-left platforms where the coordinate systems are mirrored, special care needs to be taken when mapping coordinates from one control to another to ensure the result is correctly mirrored.
Maps a point from one coordinate system to another. When the control is null, coordinates are mapped to the display. <p> NOTE: On right-to-left platforms where the coordinate systems are mirrored, special care needs to be taken when mapping coordinates from one control to another to ensure the result is correctly mirrored.
Maps a point from one coordinate system to another. When the control is null, coordinates are mapped to the display. <p> NOTE: On right-to-left platforms where the coordinate systems are mirrored, special care needs to be taken when mapping coordinates from one control to another to ensure the result is correctly mirrored.
Generate a low level system event.
Reads an event from the operating system's event queue, dispatches it appropriately, and returns <code>true</code> if there is potentially more work to do, or <code>false</code> if the caller can sleep until another event is placed on the event queue. <p> In addition to checking the system event queue, this method also checks if any inter-thread messages (created by <code>syncExec()</code> or <code>asyncExec()</code>) are waiting to be processed, and if so handles them before returning. </p>
Releases any internal resources back to the operating system and clears all fields except the device handle. <p> Disposes all shells which are currently open on the display. After this method has been invoked, all related related shells will answer <code>true</code> when sent the message <code>isDisposed()</code>. </p><p> When a device is destroyed, resources that were acquired on behalf of the programmer need to be returned to the operating system. For example, if the device allocated a font to be used as the system font, this font would be freed in <code>release</code>. Also,to assist the garbage collector and minimize the amount of memory that is not reclaimed when the programmer keeps a reference to a disposed device, all fields except the handle are zero'd. The handle is needed by <code>destroy</code>. </p> This method is called before <code>destroy</code>.
Removes the listener from the collection of listeners who will be notified when an event of the given type occurs anywhere in a widget. The event type is one of the event constants defined in class <code>SWT</code>.
Removes the listener from the collection of listeners who will be notified when an event of the given type occurs. The event type is one of the event constants defined in class <code>SWT</code>.
Sets the location of the on-screen pointer relative to the top left corner of the screen. <b>Note: It is typically considered bad practice for a program to move the on-screen pointer location.</b>
Sets the location of the on-screen pointer relative to the top left corner of the screen. <b>Note: It is typically considered bad practice for a program to move the on-screen pointer location.</b>
Sets the application defined property of the receiver with the specified name to the given argument. <p> Applications may have associated arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the display is disposed of, it is the application's responsibility provide a <code>disposeExec()</code> handler which does so. </p>
Sets the application defined, display specific data associated with the receiver, to the argument. The <em>display specific data</em> is a single, unnamed field that is stored with every display. <p> Applications may put arbitrary objects in this field. If the object stored in the display specific data needs to be notified when the display is disposed of, it is the application's responsibility provide a <code>disposeExec()</code> handler which does so. </p>
Sets the synchronizer used by the display to be the argument, which can not be null.
Causes the user-interface thread to <em>sleep</em> (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.
Causes the <code>run()</code> method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity. The thread which calls this method is suspended until the runnable completes. Specifying <code>null</code> as the runnable simply wakes the user-interface thread. <p> Note that at the time the runnable is invoked, widgets that have the receiver as their display may have been disposed. Therefore, it is necessary to check for this case inside the runnable before accessing the widget. </p>
Causes the <code>run()</code> method of the runnable to be invoked by the user-interface thread after the specified number of milliseconds have elapsed. If milliseconds is less than zero, the runnable is not executed. <p> Note that at the time the runnable is invoked, widgets that have the receiver as their display may have been disposed. Therefore, it is necessary to check for this case inside the runnable before accessing the widget. </p>
Forces all outstanding paint requests for the display to be processed before this method returns.
If the receiver's user-interface thread was <code>sleep</code>ing, causes it to be awakened and start running again. Note that this method may be called from any 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. Specifying <code>null</code> as the thread will return <code>null</code> for the display.
Returns 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.
Returns the default display. One is created (making the thread that invokes this method its user-interface thread) if it did not already exist.
On platforms which support it, sets the application name to be the argument. On Motif, for example, this can be used to set the name used for resource lookup. Specifying <code>null</code> for the name clears it.
the handle to the X Display (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. It is marked protected only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code. </p>
Throws an <code>SWTException</code> if the receiver can not be accessed by the caller. This may include both checks on the state of the receiver and more generally on the entire execution context. This method <em>should</em> be called by device implementors to enforce the standard SWT invariants. <p> Currently, it is an error to invoke any method (other than <code>isDisposed()</code> and <code>dispose()</code>) on a device that has had its <code>dispose()</code> method called. </p><p> In future releases of SWT, there may be more or fewer error checks and exceptions may be thrown for different reasons. <p>
Creates the device in the operating system. If the device does not have a handle, this method may do nothing depending on the device. <p> This method is called before <code>init</code>. </p><p> Subclasses are supposed to reimplement this method and not call the <code>super</code> implementation. </p>
Disposes of the operating system resources associated with the receiver. After this method has been invoked, the receiver will answer <code>true</code> when sent the message <code>isDisposed()</code>.
Destroys the device in the operating system and releases the device's handle. If the device does not have a handle, this method may do nothing depending on the device. <p> This method is called after <code>release</code>. </p><p> Subclasses are supposed to reimplement this method and not call the <code>super</code> implementation. </p>
Returns a rectangle describing the receiver's size and location.
Returns a <code>DeviceData</code> based on the receiver. Modifications made to this <code>DeviceData</code> will not affect the receiver.
Returns a rectangle which describes the area of the receiver which is capable of displaying data.
Returns the bit depth of the screen, which is the number of bits it takes to represent the number of unique colors that the screen is currently capable of displaying. This number will typically be one of 1, 8, 15, 16, 24 or 32.
Returns a point whose x coordinate is the horizontal dots per inch of the display, and whose y coordinate is the vertical dots per inch of the display.
Returns <code>FontData</code> objects which describe the fonts that match the given arguments. If the <code>faceName</code> is null, all fonts will be returned.
Returns the matching standard color for the given constant, which should be one of the color constants specified in class <code>SWT</code>. Any value other than one of the SWT color constants which is passed in will result in the color black. This color should not be freed because it was allocated by the system, not the application.
Returns a reasonable font for applications to use. On some platforms, this will match the "default font" or "system font" if such can be found. This font should not be freed because it was allocated by the system, not the application. <p> Typically, applications which want the default look should simply not set the font on the widgets they create. Widgets are always created with the correct default font for the class of user-interface component they represent. </p>
Returns <code>true</code> if the underlying window system prints out warning messages on the console, and <code>setWarnings</code> had previously been called with <code>true</code>.
Initializes any internal resources needed by the device. <p> This method is called after <code>create</code>. </p><p> If subclasses reimplement this method, they must call the <code>super</code> implementation. </p>
Invokes platform specific functionality to allocate a new GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Device</code>. 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. </p>
Invokes platform specific functionality to dispose a GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Device</code>. 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. </p>
Returns <code>true</code> if the device has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the device. When a device has been disposed, it is an error to invoke any other method using the device.
Loads the font specified by a file. The font will be present in the list of fonts available to the application.
Releases any internal resources back to the operating system and clears all fields except the device handle. <p> When a device is destroyed, resources that were acquired on behalf of the programmer need to be returned to the operating system. For example, if the device allocated a font to be used as the system font, this font would be freed in <code>release</code>. Also,to assist the garbage collector and minimize the amount of memory that is not reclaimed when the programmer keeps a reference to a disposed device, all fields except the handle are zero'd. The handle is needed by <code>destroy</code>. </p> This method is called before <code>destroy</code>. </p><p> If subclasses reimplement this method, they must call the <code>super</code> implementation. </p>
If the underlying window system supports printing warning messages to the console, setting warnings to <code>false</code> prevents these messages from being printed. If the argument is <code>true</code> then message printing is not blocked.
Instances of this class are responsible for managing the connection between SWT and the underlying operating system. Their most important function is to implement the SWT event loop in terms of the platform event model. They also provide various methods for accessing information about the operating system, and have overall control over the operating system resources which SWT allocates. <p> Applications which are built with SWT will <em>almost always</em> require only a single display. In particular, some platforms which SWT supports will not allow more than one <em>active</em> display. In other words, some platforms do not support creating a new display if one already exists that has not been sent the <code>dispose()</code> message. <p> In SWT, the thread which creates a <code>Display</code> instance is distinguished as the <em>user-interface thread</em> for that display. </p> The user-interface thread for a particular display has the following special attributes: <ul> <li> The event loop for that display must be run from the thread. </li> <li> Some SWT API methods (notably, most of the public methods in <code>Widget</code> and its subclasses), may only be called from the thread. (To support multi-threaded user-interface applications, class <code>Display</code> provides inter-thread communication methods which allow threads other than the user-interface thread to request that it perform operations on their behalf.) </li> <li> The thread is not allowed to construct other <code>Display</code>s 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.) </li> </ul> 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. </p><p> 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 "<code>ERROR_THREAD_INVALID_ACCESS</code>" SWT exception. </p> <dl> <dt><b>Styles:</b></dt> <dd>(none)</dd> <dt><b>Events:</b></dt> <dd>Close, Dispose, Settings</dd> </dl> <p> IMPORTANT: This class is <em>not</em> intended to be subclassed. </p> @see #syncExec @see #asyncExec @see #wake @see #readAndDispatch @see #sleep @see Device#dispose @see <a href="http://www.eclipse.org/swt/snippets/#display">Display snippets</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>