【发布时间】:2016-04-24 09:18:10
【问题描述】:
我有一个无限循环等待SwingUtilities.invokeLater 中带有Runnable 接口的事件,但执行没有继续......为什么?
//here hello3 prints in cmd but hello2 will not execute
System.out.println("hello3");
//showMessage();
SwingUtilities.invokeLater(
new Runnable(){
public void run() {
while(true) {
jEditorPane1.setText(s9);
}
}
}
);
System.out.println("hello2");
【问题讨论】:
-
以Concurrency in Swing 开头。您正在阻止 EDT。
invokeLater在未来某个时间点在 EDT 上执行run方法Runnable
标签: java swing invokelater