我有一个无限的while循环等待SwingUtilities.invokeLater
与Runnable
接口的事件,但执行没有继续...为什么?SwingUtilities.invokeLater无限循环,而不是继续?
//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");
从[并发中的Swing]开始(http://docs.oracle.com/javase/tutorial/uiswing/concurrency/)。你正在阻止美国东部时间。 'invokeLater'在将来的某个时间点在EDT上执行'Runnable'方法 – MadProgrammer