First, when the user interacts with Swing components, whether it is clicking on a button or resizing a window, the Swing toolkit generates event objects that contain relevant event information, such as event source and event ID. The event objects are then placed onto a single event queue ordered by their entry time. While that happens, a separate thread, called the event-dispatch thread, regularly checks the event queue's state. As long as the event queue is not empty, the event-dispatch thread takes event objects from the queue one by one and sends them to the interested parties. Finally, the interested parties react to the event notification by processing logic such as event handling or component painting. Figure 1 illustrates how this works.
Figure 1. Swing event-dispatch model
Since the event-dispatch thread executes all event-processing logic sequentially, it avoids undesirable situations such as painting a component whose model state is partially updated. This is great news for Swing developers because they can assume that only one thread, the event-dispatch thread, will process the event-handling code. If two event-dispatch threads worked on the event queue, Swing developers would need to write additional code for thread safety. Similarly, executing user interface-related code in any thread other than the event-dispatch thread can lead to unexpected behaviors.
- 大小: 27.9 KB
分享到:
相关推荐
MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于Facebook公司)开发,是一套优秀的作为MySQL高可用性环境下故障切换和主从提升的高可用软件...
python库。 资源全名:plum-dispatch-1.3.0.tar.gz
资源来自pypi官网。 资源全名:plum-dispatch-1.5.6.tar.gz
用于搭建MHA高可用,测试安装包可以运行,并且多次用次安装包安装成功
Log-Dispatch-2.69.tar.gz,Log-Dispatch-2.69.tar.gz,Log-Dispatch-2.69.tar.gz,MHA安装的依赖包
MHA安装依赖包
Laravel开发-laravel-single-dispatch 用于维护重复作业的Laravel Dispatcher扩展
spark-dispatch.zip
前端项目-d3-dispatch,注册命名回调并用参数调用它们。
Swift-dispatch_semaphore
OC-dispatch_semaphore
OC-dispatch_group
Swift-dispatch_group
Matlab m file for economic dispatch.
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
离线安装包,亲测可用
Combined-Heat-and-Power-System-Economic-Dispatch-master (1).zip
开源项目-khlieng-dispatch.zip,Dispatch: web-based IRC client in Go
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) at java.awt.EventDispatch...