2008-10-22 Java Judge Swing Thread private void clear(){ } if (SwingUtilities.isEventDispatchThread()) { clear(); //判断当前线程是否是EDT,是的话,就直接调用clear } else { //否则的话,将它放入EDT队列中 SwingUtilities.invokeLater( new Runnable() { public void run() { clear(); } }); } Newer SwingUtilities.invokeLater 和SwingUtilities.invokeAndWait Older extern变量和inculde的区别