As we discussed earlier, Swing relies on the older AWT GUI toolkit for top-level
window support and event dispatching. Whenever you run a Swing application,
three threads are automatically created. The first one is the main thread, which
runs your application’s main method. A second thread, called the toolkit thread,
is in charge of capturing the system events, like keyboard key presses or mouse
movements. Although this thread is vital, it is only part of AWT implementation
and never runs application code. Capture events are sent over to a third thread,
the EDT.
window support and event dispatching. Whenever you run a Swing application,
three threads are automatically created. The first one is the main thread, which
runs your application’s main method. A second thread, called the toolkit thread,
is in charge of capturing the system events, like keyboard key presses or mouse
movements. Although this thread is vital, it is only part of AWT implementation
and never runs application code. Capture events are sent over to a third thread,
the EDT.
本文探讨了Swing框架如何依赖AWT图形用户界面工具包进行顶级窗口支持及事件分发。运行Swing应用程序时会自动生成三个线程:主线程负责执行应用程序的主要方法;工具箱线程用于捕获键盘按键等系统事件;而事件调度线程则负责处理这些事件。
147

被折叠的 条评论
为什么被折叠?



