站内搜索: 请输入搜索关键词
当前页面: 图书首页 > SWT: The Standard Widget Toolkit

5.18 Summary - SWT: The Standard Widget Toolkit

Previous Section  < Day Day Up >  Next Section

5.18 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.

When designing the API for Display, we tried to make it as simple as possible, given the constraint that SWT had to be apartment-threaded. Display is really "the home of the operating system singleton."

    Previous Section  < Day Day Up >  Next Section