Tag: 事件调度线程

如何捕获事件调度线程(EDT)exception?

我正在使用一个名为MyExceptionHandler的类来实现Thread.UncaughtExceptionHandler来处理项目中的正常exception。 据我所知,这个类无法捕获EDTexception,所以我尝试在main()方法中使用它来处理EDTexception: public static void main( final String[] args ) { Thread.setDefaultUncaughtExceptionHandler( new MyExceptionHandler() ); // Handle normal exceptions System.setProperty( “sun.awt.exception.handler”,MyExceptionHandler.class.getName()); // Handle EDT exceptions SwingUtilities.invokeLater(new Runnable() { // Execute some code in the EDT. public void run() { JFrame myFrame = new JFrame(); myFrame.setVisible( true ); } }); } 但直到现在它还没有用。 例如,在初始化JFrame时,我从构造函数中的bundle文件加载其标签,如下所示: setTitle( bundle.getString( “MyJFrame.title” […]