zhsh666 发表于 2013-1-28 19:17:47

Event processing in SWT

 
The SWT event-processing cycle is depicted in figure4.1. It begins with the operating system’s event queue, which records and lists actions taken by the user. Once an  SWT application begins running, its  Display class sorts through this queue using its readAndDispatch() method and msg field, which acts as a handle to the underlying OS message queue. If it finds anything relevant, it sends the event to its top-level  Shell object, which determines which widget should receive the event. The Shell then sends the event to the widget that the user acted on, whichtransfers this information to an associated interface called a listener. One of the listener’s methods performs the necessary processing or invokes another method to handle the user’s action, called an event handler.


<img alt="">

http://dl.iteye.com/upload/attachment/161037/684d94ba-1450-3a54-8106-aa84485f143c.jpg
When making a widget responsive to events, the main tasks of the GUI designerare determining which events need to be acted on, creating and associating listeners to sense these events, and then building event handlers to perform the necessary processing.
页: [1]
查看完整版本: Event processing in SWT