Class Display
 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.
 
- The event loop for that display must be run from the thread.
- 
 Some SWT API methods (notably, most of the public methods in
 Widgetand its subclasses), may only be called from the thread. (To support multi-threaded user-interface applications, classDisplayprovides inter-thread communication methods which allow threads other than the user-interface thread to request that it perform operations on their behalf.)
- 
 The thread is not allowed to construct other
 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.)
 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.
 
- Styles:
- (none)
- Events:
- Close, Dispose, Skin
IMPORTANT: This class is not intended to be subclassed.
- Since:
- 1.0
- See Also:
- 
Field SummaryFields inherited from class org.eclipse.swt.graphics.DevicedeviceLock
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds the listener to the collection of listeners who will be notified when an event of the given type occurs anywhere in a widget.voidaddListener(int eventType, Listener listener) Adds the listener to the collection of listeners who will be notified when an event of the given type occurs.voidCauses therun()method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity.voidbeep()Causes the system hardware to emit a short sound (if it supports this capability).protected voidThrows anSWTExceptionif the receiver can not be accessed by the caller.voidclose()Requests that the connection between SWT and the underlying operating system be closed.protected voiddestroy()Destroys the device .voiddisposeExec(Runnable runnable) Causes therun()method of the runnable to be invoked by the user-interface thread just before the receiver is disposed.static DisplayfindDisplay(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.Returns the currently activeShell, or null if no shell belonging to the currently running application is active.<T> TgetAdapter(Class<T> adapter) Returns an object which is an instance of the given class parameter associated with this object ornullif no association exists.static StringReturns the application name.static StringReturns the application version.Returns a rectangle describing the receiver's size and location.static 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.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.getData()Returns the application defined, display specific data associated with the receiver, or null if it has not been set.Returns the application defined property of the receiver with the specified name, or null if it has not been set.static DisplayReturns the default display.intgetDepth()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.intReturns the button dismissal alignment, one ofLEFTorRIGHT.intReturns the longest duration, in milliseconds, between two mouse button clicks that will be considered a double click .getDPI()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 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.booleanReturns true when the high contrast mode is enabled.Returns the single instance of the application menu bar or null when there is no application menu bar for the platform.Monitor[]Returns an array of monitors attached to the device.Returns the primary monitor for that device.Shell[]Returns a (possibly empty) array containing all shells which have not been disposed and have the receiver as their display.Gets the synchronizer used by the display.Returns the thread that has invokedsyncExecor null if no such runnable is currently being invoked by the user-interface thread.getSystemColor(int id) Returns the matching standard color for the given constant, which should be one of the color constants specified in classSWT.getSystemCursor(int id) Returns the matching standard platform cursor for the given constant, which should be one of the cursor constants specified in classSWT.getSystemImage(int id) Returns the matching standard platform image for the given constant, which should be one of the icon constants specified in classSWT.Returns the single instance of the system-provided menu for the application.Returns the single instance of the system taskBar or null when there is no system taskBar available for the platform.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.booleanReturns true if a touch-aware input device is attached to the system, enabled, and ready for use.Maps a point from one coordinate system to another.Maps a point from one coordinate system to another.Maps a point from one coordinate system to another.Maps a point from one coordinate system to another.booleanReads an event from the event queue, dispatches it appropriately, and returnstrueif there is potentially more work to do, orfalseif the caller can sleep until another event is placed on the event queue.protected voidrelease()Releases any internal resources .voidremoveFilter(int eventType, Listener 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.voidremoveListener(int eventType, Listener listener) Removes the listener from the collection of listeners who will be notified when an event of the given type occurs.static voidsetAppName(String name) Sets the application name to the argument.static voidsetAppVersion(String version) Sets the application version to the argument.voidSets the application defined, display specific data associated with the receiver, to the argument.voidSets the application defined property of the receiver with the specified name to the given argument.voidsetSynchronizer(Synchronizer synchronizer) Sets the synchronizer used by the display to be the argument, which can not be null.booleansleep()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.voidCauses therun()method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity.voidCauses therun()method of the runnable to be invoked by the user-interface thread after the specified number of milliseconds have elapsed.voidupdate()Forces all outstanding paint requests for the display to be processed before this method returns.voidwake()Notifies the client to send a request in order to wake up a sleeping UI thread and to perform pending UI updates.protected voidMethods inherited from class org.eclipse.swt.graphics.Devicedispose, getClientArea, getFontList, getSystemFont, isDisposed
- 
Constructor Details- 
Displaypublic Display()Constructs a new instance of this class.Note: The resulting display is marked as the current display. If this is the first display which has been constructed since the application started, it is also marked as the default display. - Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if called from a thread that already created an existing display
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
 
- See Also:
 
 
- 
- 
Method Details- 
getCurrentReturns 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 current display
 
- 
getDefaultReturns the default display. One is created if it did not already exist.Note: In RWT, a new display is only created if the calling thread is the user-interface thread. - Returns:
- the default display
 
- 
getBoundsReturns a rectangle describing the receiver's size and location.- Overrides:
- getBoundsin class- Device
- Returns:
- the bounding rectangle
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
getDPIDescription copied from class:DeviceReturns 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.
- 
getDepthpublic int getDepth()Description copied from class:DeviceReturns 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.
- 
getFocusControlReturns 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:
- the control under the cursor
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
mapMaps a point from one coordinate system to another. When the control is null, coordinates are mapped to the display.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. Mapping a point that is the origin of a rectangle and then adding the width and height is not equivalent to mapping the rectangle. When one control is mirrored and the other is not, adding the width and height to a point that was mapped causes the rectangle to extend in the wrong direction. Mapping the entire rectangle instead of just one point causes both the origin and the corner of the rectangle to be mapped. - Parameters:
- from- the source- Controlor- null
- to- the destination- Controlor- null
- point- to be mapped
- Returns:
- point with mapped coordinates
- Throws:
- IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the point is null
- ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
mapMaps a point from one coordinate system to another. When the control is null, coordinates are mapped to the display.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. Mapping a point that is the origin of a rectangle and then adding the width and height is not equivalent to mapping the rectangle. When one control is mirrored and the other is not, adding the width and height to a point that was mapped causes the rectangle to extend in the wrong direction. Mapping the entire rectangle instead of just one point causes both the origin and the corner of the rectangle to be mapped. - Parameters:
- from- the source- Controlor- null
- to- the destination- Controlor- null
- x- coordinates to be mapped
- y- coordinates to be mapped
- Returns:
- point with mapped coordinates
- Throws:
- IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
mapMaps a point from one coordinate system to another. When the control is null, coordinates are mapped to the display.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. Mapping a point that is the origin of a rectangle and then adding the width and height is not equivalent to mapping the rectangle. When one control is mirrored and the other is not, adding the width and height to a point that was mapped causes the rectangle to extend in the wrong direction. Mapping the entire rectangle instead of just one point causes both the origin and the corner of the rectangle to be mapped. - Parameters:
- from- the source- Controlor- null
- to- the destination- Controlor- null
- rectangle- to be mapped
- Returns:
- rectangle with mapped coordinates
- Throws:
- IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the rectangle is null
- ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
mapMaps a point from one coordinate system to another. When the control is null, coordinates are mapped to the display.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. Mapping a point that is the origin of a rectangle and then adding the width and height is not equivalent to mapping the rectangle. When one control is mirrored and the other is not, adding the width and height to a point that was mapped causes the rectangle to extend in the wrong direction. Mapping the entire rectangle instead of just one point causes both the origin and the corner of the rectangle to be mapped. - Parameters:
- from- the source- Controlor- null
- to- the destination- Controlor- null
- x- coordinates to be mapped
- y- coordinates to be mapped
- width- coordinates to be mapped
- height- coordinates to be mapped
- Returns:
- rectangle with mapped coordinates
- Throws:
- IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the Control from or the Control to have been disposed
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
addListenerAdds 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 classSWT. When the event does occur in the display, the listener is notified by sending it thehandleEvent()message.- Parameters:
- eventType- the type of event to listen for
- listener- the listener which should be notified when the event occurs
- Throws:
- IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
- See Also:
 
- 
removeListenerRemoves 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 classSWT.- Parameters:
- eventType- the type of event to listen for
- listener- the listener which should no longer be notified
- Throws:
- IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
- See Also:
 
- 
disposeExecCauses therun()method of the runnable to be invoked by the user-interface thread just before the receiver is disposed. Specifying anullrunnable is ignored.- Parameters:
- runnable- code to run at dispose time.
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
closepublic void close()Requests that the connection between SWT and the underlying operating system be closed.- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
- See Also:
 
- 
releaseprotected void release()Description copied from class:DeviceReleases any internal resources .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 This method is called beforerelease. 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 bydestroy.destroy.If subclasses reimplement this method, they must call the superimplementation.
- 
destroyprotected void destroy()Description copied from class:DeviceDestroys the device . If the device does not have a handle, this method may do nothing depending on the device.This method is called after release.Subclasses are supposed to reimplement this method and not call the superimplementation.
- 
getAdapterDescription copied from interface:AdaptableReturns an object which is an instance of the given class parameter associated with this object or nullif no association exists.- Specified by:
- getAdapterin interface- Adaptable
- Parameters:
- adapter- the lookup class
- Returns:
- an object that can be cast to the given class or nullif there is no adapter associated with the given class.
 
- 
getShellsReturns a (possibly empty) array containing all shells which have not been disposed and have the receiver as their display.- Returns:
- the receiver's shells
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
getActiveShellReturns the currently activeShell, or null if no shell belonging to the currently running application is active.- Returns:
- the active shell or null
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
getThreadReturns the user-interface thread for the receiver. Note that the user-interface thread may change per user-request.- Returns:
- the receiver's user-interface thread or null if there's no current user-request executed that belongs to the display.
- Throws:
- SWTException-- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
findDisplayReturns 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. Specifyingnullas the thread will returnnullfor the display.- Parameters:
- thread- the user-interface thread
- Returns:
- the display for the given thread
 
- 
setSynchronizerSets the synchronizer used by the display to be the argument, which can not be null.- Parameters:
- synchronizer- the new synchronizer for the display (must not be null)
- Throws:
- IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the synchronizer is null
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
- ERROR_FAILED_EXEC - if an exception occurred while running an inter-thread message
 
- Since:
- 1.3
 
- 
getSynchronizerGets the synchronizer used by the display.- Returns:
- the receiver's synchronizer
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
 
- 
getSyncThreadReturns the thread that has invokedsyncExecor null if no such runnable is currently being invoked by the user-interface thread.Note: If a runnable invoked by asyncExec is currently running, this method will return null. - Returns:
- the receiver's sync-interface thread
- Throws:
- SWTException-- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
 
- 
asyncExecCauses therun()method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity. Note that the user-interface thread may change per user-request. The caller of this method continues to run in parallel, and is not notified when the runnable has completed. Specifyingnullas the runnable simply wakes the user-interface thread when run.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. - Parameters:
- runnable- code to run on the user-interface thread or- null
- Throws:
- SWTException-- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- See Also:
 
- 
syncExecCauses therun()method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity. Note that the user-interface thread may change per user-request. The thread which calls this method is suspended until the runnable completes. Specifyingnullas the runnable simply wakes the user-interface thread.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. - Parameters:
- runnable- code to run on the user-interface thread or- null
- Throws:
- SWTException-- ERROR_FAILED_EXEC - if an exception occured when executing the runnable
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- See Also:
 
- 
timerExecCauses therun()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.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. - Parameters:
- milliseconds- the delay before running the runnable
- runnable- code to run on the user-interface thread
- Throws:
- IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the runnable is null
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.2
- See Also:
 
- 
readAndDispatchpublic boolean readAndDispatch()Reads an event from the event queue, dispatches it appropriately, and returnstrueif there is potentially more work to do, orfalseif the caller can sleep until another event is placed on the event queue.In addition to checking the system event queue, this method also checks if any inter-thread messages (created by syncExec()orasyncExec()) are waiting to be processed, and if so handles them before returning.- Returns:
- falseif the caller can sleep upon return from this method
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
- ERROR_FAILED_EXEC - if an exception occurred while running an inter-thread message
 
- Since:
- 1.1
- See Also:
 
- 
sleeppublic boolean sleep()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.- Returns:
- trueif an event requiring dispatching was placed on the queue.
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.1
- See Also:
 
- 
wakepublic void wake()Notifies the client to send a request in order to wake up a sleeping UI thread and to perform pending UI updates. Note that this method may be called from any thread.Note that this method has no effect unless a ServerPushSessionis active.- Throws:
- SWTException-- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
 
- 
wakeThreadprotected void wakeThread()
- 
getSystemTrayReturns the single instance of the system tray or null when there is no system tray available for the platform.- Returns:
- the system tray or null
- Throws:
- SWTException-- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.4
 
- 
getMenuBarReturns the single instance of the application menu bar or null when there is no application menu bar for the platform.- Returns:
- the application menu bar or null
- Throws:
- SWTException-- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.4
 
- 
getSystemTaskBarReturns the single instance of the system taskBar or null when there is no system taskBar available for the platform.- Returns:
- the system taskBar or null
- Throws:
- SWTException-- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.4
 
- 
getSystemMenuReturns the single instance of the system-provided menu for the application. On platforms where no menu is provided for the application this method returns null.- Returns:
- the system menu or null
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.4
 
- 
getSystemColorDescription copied from class:DeviceReturns the matching standard color for the given constant, which should be one of the color constants specified in classSWT. 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.- Overrides:
- getSystemColorin class- Device
- Parameters:
- id- the color constant
- Returns:
- the matching color
- See Also:
 
- 
getSystemImageReturns the matching standard platform image for the given constant, which should be one of the icon constants specified in classSWT. This image should not be free'd because it was allocated by the system, not the application. A value ofnullwill 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.- Parameters:
- id- the SWT icon constant
- Returns:
- the corresponding image or null
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- See Also:
 
- 
getSystemCursorReturns the matching standard platform cursor for the given constant, which should be one of the cursor constants specified in classSWT. This cursor should not be free'd because it was allocated by the system, not the application. A value ofnullwill be returned if the supplied constant is not an SWT cursor constant.- Parameters:
- id- the SWT cursor constant
- Returns:
- the corresponding cursor or null
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
- See Also:
 
- 
getDoubleClickTimepublic int getDoubleClickTime()Returns the longest duration, in milliseconds, between two mouse button clicks that will be considered a double click .- Returns:
- the double click time
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.2
 
- 
getCursorControlReturns 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 control under the cursor or null
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
 
- 
getDismissalAlignmentpublic int getDismissalAlignment()Returns the button dismissal alignment, one ofLEFTorRIGHT. 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 isLEFT, the button ordering should be OK/CANCEL. When button dismissal alignment isRIGHT, the button ordering should be CANCEL/OK.- Returns:
- the button dismissal order
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
 
- 
getHighContrastpublic boolean getHighContrast()Returns true when the high contrast mode is enabled. Otherwise, false is returned.Note: This operation is a hint and is not supported on platforms that do not have this concept. - Returns:
- the high contrast mode
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
 
- 
getCursorLocationReturns the location of the on-screen pointer relative to the top left corner of the screen.- Returns:
- the cursor location
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
 
- 
addFilterAdds 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 classSWT. When the event does occur, the listener is notified by sending it thehandleEvent()message.Setting the type of an event to SWT.Nonefrom within thehandleEvent()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.NOTE: In RAP, only events that have a matching listener registered on the event's source widget are processed on the server. One exception are key events, for which a whitelist can be define using RWT#ACTIVE_KEYS.- Parameters:
- eventType- the type of event to listen for
- listener- the listener which should be notified when the event occurs
- Throws:
- IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- See Also:
 
- 
removeFilterRemoves 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 classSWT.- Parameters:
- eventType- the type of event to listen for
- listener- the listener which should no longer be notified when the event occurs
- Throws:
- IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
 
- See Also:
 
- 
getDataReturns the application defined, display specific data associated with the receiver, or null if it has not been set. The display specific data is a single, unnamed field that is stored with every display.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 disposeExec()handler which does so.- Returns:
- the display specific data
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.2
- See Also:
 
- 
setDataSets the application defined, display specific data associated with the receiver, to the argument. The display specific data is a single, unnamed field that is stored with every display.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 disposeExec()handler which does so.- Parameters:
- data- the new display specific data
- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.2
- See Also:
 
- 
setDataSets the application defined property of the receiver with the specified name to the given argument.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 disposeExec()handler which does so.- Parameters:
- key- the name of the property
- value- the new value for the property
- Throws:
- IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the key is null
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.2
- See Also:
 
- 
getDataReturns the application defined property of the receiver with the specified name, or null if it has not been set.Applications may have associated arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the display is disposed of, it is the application's responsibility to provide a disposeExec()handler which does so.- Parameters:
- key- the name of the property
- Returns:
- the value of the property or null if it has not been set
- Throws:
- IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the key is null
 
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.2
- See Also:
 
- 
getMonitorsReturns an array of monitors attached to the device.- Returns:
- the array of monitors
- Since:
- 1.2
 
- 
getPrimaryMonitorReturns the primary monitor for that device.- Returns:
- the primary monitor
- Since:
- 1.2
 
- 
getAppNameReturns the application name.- Returns:
- the application name
- Since:
- 1.3
- See Also:
 
- 
getAppVersionReturns the application version.- Returns:
- the application version
- Since:
- 1.3
- See Also:
 
- 
setAppNameSets the application name to the argument.Specifying nullfor the name clears it.- Parameters:
- name- the new app name or- null
- Since:
- 1.3
 
- 
setAppVersionSets the application version to the argument.- Parameters:
- version- the new app version
- Since:
- 1.3
 
- 
updatepublic void update()Forces all outstanding paint requests for the display to be processed before this method returns.- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
- See Also:
 
- 
beeppublic void beep()Causes the system hardware to emit a short sound (if it supports this capability).- Throws:
- SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
 
- Since:
- 1.3
 
- 
getTouchEnabledpublic boolean getTouchEnabled()Returns true if a touch-aware input device is attached to the system, enabled, and ready for use.- Since:
- 1.4
 
- 
checkDeviceprotected void checkDevice()Description copied from class:DeviceThrows anSWTExceptionif 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 should be called by device implementors to enforce the standard SWT invariants.Currently, it is an error to invoke any method (other than isDisposed()anddispose()) on a device that has had itsdispose()method called.In future releases of SWT, there may be more or fewer error checks and exceptions may be thrown for different reasons. - Overrides:
- checkDevicein class- Device
 
 
-