Share this Page URL

Chapter 5. Display > Summary - Pg. 84

Display 84 Double-Click Time Normally, SWT detects double-click events for you and passes them to your application using an SWT.MouseDoubleClick event (see the Events and Listeners section of the Widget Fundamentals chapter). However, it is also possible to identify double-clicks manually by detecting whether the length of time between clicks is below some threshold. Because most operating systems allow users to set their preferred threshold for double-clicks, SWT provides API that returns the platform double- click time. getDoubleClickTime()-- Returns the maximum length of time, in milliseconds, that can occur between two mouse clicks in order for the operating system to treat them as a double-click. Summary In this chapter, you learned about the class Display. This class has a rather large API devoted to many different operating system tasks. Two very complex and interrelated topics, the event loop and threading, were discussed in detail. The key point to remember from this discussion is that SWT is apartment-threaded, serializing access to the user interface through the methods syncExec() and asyncExec(). Runnables, queued by these two methods, are executed in the event loop when the user interface thread is idle. Timers were also introduced as another mechanism to queue work. Much of the rest of the chapter dealt with miscellaneous API whose general theme was "one per application." For example, there is one list of monitors, one primary monitor, one list of Shells, one active Shell, one focus control, one cursor location, and so on. By studying dismissal alignment and coordinate mapping and mirroring, then using the code patterns described in those sections, your application will behave properly on platforms that are sensitive to these issues.