大家好,我想在美国东部夏令时完成一项任务:
new Thread(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
fBPC.repaint();
System.out.println("toto");
if (SwingUtilities.isEventDispatchThread()){
System.out.println("titi");
}
}
}).run();
它显示:
托托
平铺
难道我不应该只得到:"toto“,因为我创建了一个新的线程吗?
如果没有,请向我解释如何使东西在一个线程的EDT。
谢谢你的帮助。
发布于 2013-06-01 20:41:33
使用Thread.start()
而不是Thread.run()
。
https://stackoverflow.com/questions/16872776
复制相似问题