读书人

java的gui(2)

发布时间: 2012-12-28 10:29:04 作者: rapoo

java的gui(二)
既然这EventDispatchThread是一个线程,那肯定是从run方法开始了

run中的finally块中有块有意思的代码

/*                 * Fix for 4648733. Check both the associated java event                 * queue and the PostEventQueue.                 */                if (theQueue.peekEvent() != null ||                     !SunToolkit.isPostEventQueueEmpty()) {                     theQueue.initDispatchThread();                }

像我们调试中经常发现有unchecked exception没有捕获,在console打印出来了,但貌似没任何影响,这是为什么呢?
就是这一小段代码的功劳了。
线程死了,但它又让线程恢复过来了

读书人网 >编程

热点推荐