|
发表于 2005-3-1 20:47:35
|
显示全部楼层
http://java.sun.com/docs/books/t ... html#handlingEvents
页面的最下面有一个note如下:
Note: Event-handling code executes in an single thread, the event-dispatching thread. This ensures that each event handler finishes execution before the next one executes. For instance, the actionPerformed method in the preceding example executes in the event-dispatching thread. Painting code also executes in the event-dispatching thread. Therefore, event-handling code should execute quickly so that the program抯 GUI stays responsive. If an event takes too long to execute, the GUI will freeze--that is, it won抰 repaint or respond to mouse clicks. Writing Event Listeners (in the Creating a GUI with JFC/Swing trail) has for more information.
大概的意思就是事件处理方法都是在一个单线程(event-dispatching thread)里处理的,也就是说如果有多个evenet listener,它们是顺序执行的。 |
|