gpt4 book ai didi

java - EDT 和运行时异常

转载 作者:行者123 更新时间:2023-12-02 09:16:02 25 4
gpt4 key购买 nike

如果从 EDT 线程调用某些方法出现未经检查的异常,会发生什么情况?它能保持 GUI 的响应能力还是什么?谢谢您

最佳答案

Before restarting, does the EDT shutdown all components that were previously displayed?

不,EDT 只是像以前一样继续执行 Runnable 实例;损坏的 Runnable 继续抛出异常。作为练习,请检查调试器中的 example cited

附录:这是来自此 example 的典型堆栈跟踪。

chart.DTSCTest$1.actionPerformed(DTSCTest.java:53)javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)java.awt.Component.processMouseEvent(Component.java:6373)javax.swing.JComponent.processMouseEvent(JComponent.java:3267)java.awt.Component.processEvent(Component.java:6138)java.awt.Container.processEvent(Container.java:2085)java.awt.Component.dispatchEventImpl(Component.java:4735)java.awt.Container.dispatchEventImpl(Container.java:2143)java.awt.Component.dispatchEvent(Component.java:4565)java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4621)java.awt.LightweightDispatcher.processMouseEvent(Container.java:4282)java.awt.LightweightDispatcher.dispatchEvent(Container.java:4212)java.awt.Container.dispatchEventImpl(Container.java:2129)java.awt.Window.dispatchEventImpl(Window.java:2478)java.awt.Component.dispatchEvent(Component.java:4565)java.awt.EventQueue.dispatchEventImpl(EventQueue.java:679)java.awt.EventQueue.access$000(EventQueue.java:85)java.awt.EventQueue$1.run(EventQueue.java:638)java.awt.EventQueue$1.run(EventQueue.java:636)java.security.AccessController.doPrivileged(AccessController.java)java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)java.awt.EventQueue$2.run(EventQueue.java:652)java.awt.EventQueue$2.run(EventQueue.java:650)java.security.AccessController.doPrivileged(AccessController.java)java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)java.awt.EventQueue.dispatchEvent(EventQueue.java:649)java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

关于java - EDT 和运行时异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12077826/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com