Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.swt.widgets
Class Display  view Display download Display.java

java.lang.Object
  extended byorg.eclipse.swt.graphics.Device
      extended byorg.eclipse.swt.widgets.Display
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class Display
extends org.eclipse.swt.graphics.Device

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.

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 user-interface thread for a particular display has the following special attributes: 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.

Styles:
(none)
Events:
Close, Dispose

IMPORTANT: This class is not intended to be subclassed.


Field Summary
(package private) static java.lang.String APP_NAME
           
(package private)  int borderTrimHeight
           
(package private)  int borderTrimWidth
           
(package private)  org.eclipse.swt.internal.Callback caretCallback
           
(package private)  int caretId
           
(package private)  long caretProc
           
(package private)  org.eclipse.swt.internal.Callback checkIfEventCallback
           
(package private)  long checkIfEventProc
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_INFO_BACKGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_INFO_FOREGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_LIST_BACKGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_LIST_FOREGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_LIST_SELECTION
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_LIST_SELECTION_TEXT
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_TEXT_BACKGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_TEXT_FOREGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_BACKGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_BACKGROUND_GRADIENT
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_FOREGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_INACTIVE_BACKGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_INACTIVE_FOREGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_BACKGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_BORDER
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_DARK_SHADOW
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_FOREGROUND
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_HIGHLIGHT_SHADOW
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_LIGHT_SHADOW
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_NORMAL_SHADOW
           
(package private)  Caret currentCaret
           
(package private)  org.eclipse.swt.graphics.Cursor[] cursors
           
(package private)  java.lang.Object data
           
(package private) static Display Default
           
(package private)  long defaultFont
           
(package private) static java.lang.String DISPATCH_EVENT_KEY
           
(package private)  int[] dispatchEvents
           
(package private) static Display[] Displays
           
(package private)  java.lang.Runnable[] disposeList
           
(package private) static int DOUBLE_CLICK_TIME
           
(package private)  boolean dragging
           
(package private)  int dragStartX
           
(package private)  int dragStartY
           
(package private)  long errorMask
           
(package private)  long errorPixmap
           
(package private)  org.eclipse.swt.internal.Callback eventCallback
           
(package private)  long eventProc
           
(package private)  Event[] eventQueue
           
(package private)  EventTable eventTable
           
(package private)  org.eclipse.swt.internal.gtk.XExposeEvent exposeEvent
           
(package private)  org.eclipse.swt.internal.Callback filterCallback
           
(package private)  long filterProc
           
(package private)  EventTable filterTable
           
(package private)  boolean flushAll
           
(package private)  long[] flushData
           
(package private)  org.eclipse.swt.internal.gtk.GdkRectangle flushRect
           
(package private)  long flushWindow
           
(package private)  int freeSlot
           
(package private)  org.eclipse.swt.internal.gtk.GdkEventButton gdkEvent
           
(package private)  int gdkEventCount
           
(package private)  long[] gdkEvents
           
(package private)  Widget[] gdkEventWidgets
           
(package private) static int GROW_SIZE
           
(package private)  Control imControl
           
(package private)  int[] indexTable
           
(package private)  long infoMask
           
(package private)  long infoPixmap
           
(package private)  java.lang.String[] keys
           
(package private) static int[][] KeyTable
           
(package private) static int MAJOR
           
(package private)  org.eclipse.swt.internal.Callback menuPositionCallback
           
(package private)  long menuPositionProc
           
(package private) static int MICRO
           
(package private) static int MINOR
           
(package private)  Control mnemonicControl
           
(package private)  org.eclipse.swt.internal.Callback mouseHoverCallback
           
(package private)  long mouseHoverHandle
           
(package private)  int mouseHoverId
           
(package private)  long mouseHoverProc
           
(package private) static java.lang.Class OS_LOCK
           
(package private) static java.lang.String PACKAGE_PREFIX
           
(package private)  org.eclipse.swt.internal.Callback pixbufCellDataCallback
           
(package private)  long pixbufCellDataProc
           
(package private)  Menu[] popups
           
(package private)  int popupTime
           
(package private)  long preeditLabel
           
(package private)  long preeditWindow
           
(package private)  long questionMask
           
(package private)  long questionPixmap
           
(package private)  int resizeTrimHeight
           
(package private)  int resizeTrimWidth
           
(package private)  org.eclipse.swt.internal.Callback shellMapCallback
           
(package private)  long shellMapProc
           
(package private) static int SWT_OBJECT_INDEX
           
(package private)  Synchronizer synchronizer
           
(package private)  org.eclipse.swt.internal.Callback textCellDataCallback
           
(package private)  long textCellDataProc
           
(package private)  java.lang.Thread thread
           
(package private)  org.eclipse.swt.internal.Callback timerCallback
           
(package private)  int[] timerIds
           
(package private)  java.lang.Runnable[] timerList
           
(package private)  long timerProc
           
(package private)  int titleBorderTrimHeight
           
(package private)  int titleBorderTrimWidth
           
(package private)  int titleResizeTrimHeight
           
(package private)  int titleResizeTrimWidth
           
(package private)  int titleTrimHeight
           
(package private)  int titleTrimWidth
           
(package private)  Tray tray
           
(package private)  int[] treeSelection
           
(package private)  org.eclipse.swt.internal.Callback treeSelectionCallback
           
(package private)  int treeSelectionLength
           
(package private)  long treeSelectionProc
           
(package private)  java.lang.Object[] values
           
(package private)  org.eclipse.swt.internal.gtk.XVisibilityEvent visibilityEvent
           
(package private)  boolean wake
           
(package private)  long warningMask
           
(package private)  long warningPixmap
           
(package private)  Widget[] widgetTable
           
(package private)  org.eclipse.swt.internal.Callback windowCallback2
           
(package private)  org.eclipse.swt.internal.Callback windowCallback3
           
(package private)  org.eclipse.swt.internal.Callback windowCallback4
           
(package private)  org.eclipse.swt.internal.Callback windowCallback5
           
(package private)  long windowProc2
           
(package private)  long windowProc3
           
(package private)  long windowProc4
           
(package private)  long windowProc5
           
(package private)  org.eclipse.swt.internal.Callback windowTimerCallback
           
(package private)  long windowTimerProc
           
 
Fields inherited from class org.eclipse.swt.graphics.Device
CurrentDevice, DEBUG, DeviceFinder
 
Constructor Summary
Display()
          Constructs a new instance of this class.
Display(org.eclipse.swt.graphics.DeviceData data)
           
 
Method Summary
 void addFilter(int eventType, Listener listener)
          Adds the listener to the collection of listeners who will be notifed when an event of the given type occurs anywhere in this display.
(package private)  void addGdkEvent(long event)
           
 void addListener(int eventType, Listener listener)
          Adds the listener to the collection of listeners who will be notifed when an event of the given type occurs.
(package private)  void addMouseHoverTimeout(long handle)
           
(package private)  void addPopup(Menu menu)
           
(package private)  void addWidget(long handle, Widget widget)
           
 void asyncExec(java.lang.Runnable runnable)
          Causes the run() method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity.
 void beep()
          Causes the system hardware to emit a short sound (if it supports this capability).
(package private)  long caretProc(long clientData)
           
protected  void checkDevice()
          Throws an SWTException if the receiver can not be accessed by the caller.
(package private) static void checkDisplay(java.lang.Thread thread)
           
(package private)  long checkIfEventProc(long display, long xEvent, long userData)
           
protected  void checkSubclass()
          Checks that this class can be subclassed.
 void close()
          Requests that the connection between SWT and the underlying operating system be closed.
protected  void create(org.eclipse.swt.graphics.DeviceData data)
          Creates the device in the operating system.
(package private)  void createDisplay(org.eclipse.swt.graphics.DeviceData data)
           
(package private)  long[] createImage(java.lang.String name)
           
(package private)  void deregister()
           
protected  void destroy()
          Destroys the device in the operating system and releases the device's handle.
(package private)  void destroyDisplay()
           
 void disposeExec(java.lang.Runnable runnable)
          Causes the run() method of the runnable to be invoked by the user-interface thread just before the receiver is disposed.
(package private)  void error(int code)
          Does whatever display specific cleanup is required, and then uses the code in SWTError.error to handle the error.
(package private)  long eventProc(long event, long data)
           
(package private)  boolean filterEvent(Event event)
           
(package private)  long filterProc(long xEvent, long gdkEvent, long data)
           
(package private)  boolean filters(int eventType)
           
static Display findDisplay(java.lang.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.
 Widget findWidget(long handle)
          Given the operating system handle for a widget, returns the instance of the Widget subclass which represents it in the currently running application, if such exists, or null if no matching widget can be found.
(package private)  void flushExposes(long window, boolean all)
           
 Shell getActiveShell()
          Returns the currently active Shell, or null if no shell belonging to the currently running application is active.
 org.eclipse.swt.graphics.Rectangle getBounds()
          Returns a rectangle describing the receiver's size and location.
static Display getCurrent()
          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.
 Control getCursorControl()
          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.
 org.eclipse.swt.graphics.Point getCursorLocation()
          Returns the location of the on-screen pointer relative to the top left corner of the screen.
 org.eclipse.swt.graphics.Point[] getCursorSizes()
          Returns an array containing the recommended cursor sizes.
 java.lang.Object getData()
          Returns the application defined, display specific data associated with the receiver, or null if it has not been set.
 java.lang.Object getData(java.lang.String key)
          Returns the application defined property of the receiver with the specified name, or null if it has not been set.
static Display getDefault()
          Returns the default display.
 int getDepth()
          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.
 int getDismissalAlignment()
          Returns the button dismissal alignment, one of LEFT or RIGHT.
 int getDoubleClickTime()
          Returns the longest duration, in milliseconds, between two mouse button clicks that will be considered a double click by the underlying operating system.
 org.eclipse.swt.graphics.Point 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.
 Control getFocusControl()
          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.
 boolean getHighContrast()
          Returns true when the high contrast mode is enabled.
 int getIconDepth()
          Returns the maximum allowed depth of icons on this display.
 org.eclipse.swt.graphics.Point[] getIconSizes()
          Returns an array containing the recommended icon sizes.
(package private)  int getLastEventTime()
           
(package private)  int getMessageCount()
           
 Monitor[] getMonitors()
          Returns an array of monitors attached to the device.
 Monitor getPrimaryMonitor()
          Returns the primary monitor for that device.
 Shell[] getShells()
          Returns an array containing all shells which have not been disposed and have the receiver as their display.
 java.lang.Thread getSyncThread()
          Returns the thread that has invoked syncExec or null if no such runnable is currently being invoked by the user-interface thread.
 org.eclipse.swt.graphics.Color getSystemColor(int id)
          Returns the matching standard color for the given constant, which should be one of the color constants specified in class SWT.
 org.eclipse.swt.graphics.Cursor getSystemCursor(int id)
          Returns the matching standard platform cursor for the given constant, which should be one of the cursor constants specified in class SWT.
 org.eclipse.swt.graphics.Font getSystemFont()
          Returns a reasonable font for applications to use.
 org.eclipse.swt.graphics.Image getSystemImage(int id)
          Returns the matching standard platform image for the given constant, which should be one of the icon constants specified in class SWT.
 Tray getSystemTray()
          Returns the single instance of the system tray.
 java.lang.Thread getThread()
          Returns the user-interface thread for the receiver.
(package private)  Widget getWidget(long handle)
           
protected  void init()
          Initializes any internal resources needed by the device.
(package private)  void initializeCallbacks()
           
(package private)  void initializeSystemResources()
           
(package private)  void initializeWidgetTable()
           
 void internal_dispose_GC(long gdkGC, org.eclipse.swt.graphics.GCData data)
          Invokes platform specific functionality to dispose a GC handle.
 long internal_new_GC(org.eclipse.swt.graphics.GCData data)
          Invokes platform specific functionality to allocate a new GC handle.
(package private) static boolean isValidClass(java.lang.Class clazz)
           
(package private)  boolean isValidThread()
           
 org.eclipse.swt.graphics.Point map(Control from, Control to, int x, int y)
          Maps a point from one coordinate system to another.
 org.eclipse.swt.graphics.Rectangle map(Control from, Control to, int x, int y, int width, int height)
          Maps a point from one coordinate system to another.
 org.eclipse.swt.graphics.Point map(Control from, Control to, org.eclipse.swt.graphics.Point point)
          Maps a point from one coordinate system to another.
 org.eclipse.swt.graphics.Rectangle map(Control from, Control to, org.eclipse.swt.graphics.Rectangle rectangle)
          Maps a point from one coordinate system to another.
(package private) static char mbcsToWcs(char ch)
           
(package private)  long menuPositionProc(long menu, long x, long y, long push_in, long user_data)
           
(package private)  long mouseHoverProc(long handle)
           
(package private)  long pixbufCellDataProc(long tree_column, long cell, long tree_model, long iter, long data)
           
 boolean post(Event event)
          Generate a low level system event.
(package private)  void postEvent(Event event)
           
(package private)  void putGdkEvents()
           
 boolean readAndDispatch()
          Reads an event from the operating system's event queue, dispatches it appropriately, and returns true if there is potentially more work to do, or false if the caller can sleep until another event is placed on the event queue.
(package private)  void register()
           
protected  void release()
          Releases any internal resources back to the operating system and clears all fields except the device handle.
(package private)  void releaseDisplay()
           
 void removeFilter(int eventType, Listener listener)
          Removes the listener from the collection of listeners who will be notifed when an event of the given type occurs anywhere in this display.
(package private)  long removeGdkEvent()
           
 void removeListener(int eventType, Listener listener)
          Removes the listener from the collection of listeners who will be notifed when an event of the given type occurs.
(package private)  void removeMouseHoverTimeout(long handle)
           
(package private)  void removePopup(Menu menu)
           
(package private)  Widget removeWidget(long handle)
           
(package private)  boolean runAsyncMessages()
           
(package private)  boolean runDeferredEvents()
           
(package private)  boolean runPopups()
           
(package private)  void sendEvent(int eventType, Event event)
           
static void setAppName(java.lang.String name)
          On platforms which support it, sets the application name to be the argument.
(package private)  void setCurrentCaret(Caret caret)
           
 void setCursorLocation(int x, int y)
          Sets the location of the on-screen pointer relative to the top left corner of the screen.
 void setCursorLocation(org.eclipse.swt.graphics.Point point)
          Sets the location of the on-screen pointer relative to the top left corner of the screen.
 void setData(java.lang.Object data)
          Sets the application defined, display specific data associated with the receiver, to the argument.
 void setData(java.lang.String key, java.lang.Object value)
          Sets the application defined property of the receiver with the specified name to the given argument.
(package private) static void setDevice(org.eclipse.swt.graphics.Device device)
           
 void setSynchronizer(Synchronizer synchronizer)
          Sets the synchronizer used by the display to be the argument, which can not be null.
(package private)  long shellMapProc(long handle, long arg0, long user_data)
           
(package private)  void showIMWindow(Control control)
           
 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.
 void syncExec(java.lang.Runnable runnable)
          Causes the run() method of the runnable to be invoked by the user-interface thread at the next reasonable opportunity.
(package private)  long textCellDataProc(long tree_column, long cell, long tree_model, long iter, long data)
           
 void timerExec(int milliseconds, java.lang.Runnable runnable)
          Causes the run() method of the runnable to be invoked by the user-interface thread after the specified number of milliseconds have elapsed.
(package private)  long timerProc(long i)
           
(package private) static int translateKey(int key)
           
(package private)  long treeSelectionProc(long model, long path, long iter, long data)
           
(package private) static int untranslateKey(int key)
           
 void update()
          Forces all outstanding paint requests for the display to be processed before this method returns.
 void wake()
          If the receiver's user-interface thread was sleep'ing, causes it to be awakened and start running again.
(package private)  void wakeThread()
           
(package private) static char wcsToMbcs(char ch)
           
(package private)  long windowProc(long handle, long user_data)
           
(package private)  long windowProc(long handle, long arg0, long user_data)
           
(package private)  long windowProc(long handle, long arg0, long arg1, long user_data)
           
(package private)  long windowProc(long handle, long arg0, long arg1, long arg2, long user_data)
           
(package private)  long windowTimerProc(long handle)
           
 
Methods inherited from class org.eclipse.swt.graphics.Device
dispose, getClientArea, getDeviceData, getFontList, getWarnings, isDisposed, setWarnings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wake

boolean wake

gdkEventCount

int gdkEventCount

gdkEvents

long[] gdkEvents

dispatchEvents

int[] dispatchEvents

gdkEventWidgets

Widget[] gdkEventWidgets

eventQueue

Event[] eventQueue

eventCallback

org.eclipse.swt.internal.Callback eventCallback

filterCallback

org.eclipse.swt.internal.Callback filterCallback

gdkEvent

org.eclipse.swt.internal.gtk.GdkEventButton gdkEvent

eventProc

long eventProc

filterProc

long filterProc

windowProc2

long windowProc2

windowProc3

long windowProc3

windowProc4

long windowProc4

windowProc5

long windowProc5

windowCallback2

org.eclipse.swt.internal.Callback windowCallback2

windowCallback3

org.eclipse.swt.internal.Callback windowCallback3

windowCallback4

org.eclipse.swt.internal.Callback windowCallback4

windowCallback5

org.eclipse.swt.internal.Callback windowCallback5

eventTable

EventTable eventTable

filterTable

EventTable filterTable

APP_NAME

static java.lang.String APP_NAME

DISPATCH_EVENT_KEY

static final java.lang.String DISPATCH_EVENT_KEY
See Also:
Constant Field Values

freeSlot

int freeSlot

indexTable

int[] indexTable

widgetTable

Widget[] widgetTable

GROW_SIZE

static final int GROW_SIZE
See Also:
Constant Field Values

SWT_OBJECT_INDEX

static final int SWT_OBJECT_INDEX

imControl

Control imControl

preeditWindow

long preeditWindow

preeditLabel

long preeditLabel

synchronizer

Synchronizer synchronizer

thread

java.lang.Thread thread

disposeList

java.lang.Runnable[] disposeList

tray

Tray tray

timerIds

int[] timerIds

timerList

java.lang.Runnable[] timerList

timerCallback

org.eclipse.swt.internal.Callback timerCallback

timerProc

long timerProc

windowTimerCallback

org.eclipse.swt.internal.Callback windowTimerCallback

windowTimerProc

long windowTimerProc

currentCaret

Caret currentCaret

caretCallback

org.eclipse.swt.internal.Callback caretCallback

caretId

int caretId

caretProc

long caretProc

mnemonicControl

Control mnemonicControl

mouseHoverId

int mouseHoverId

mouseHoverHandle

long mouseHoverHandle

mouseHoverProc

long mouseHoverProc

mouseHoverCallback

org.eclipse.swt.internal.Callback mouseHoverCallback