我的职责之一是处理以下代码:
jLabel2.setBackground(Color.YELLOW);
jLabel2.setText("Status : Idle");
boolean ok=cpu21.RestartSSH();
if(ok){
jLabel2.setBackground(Color.GREEN);
jLabel2.setText("Status : Run");
}
进入函数之前标签是绿色和“运行”,但是进入函数后,标签没有变成黄色(函数RestartSSH执行5-6秒钟,但在此期间标签没有改变颜色并且截图)。我在绘制方面犯了什么错误?
Thread
应该使用invokeLater()
,如此处所建议 http://en.wikipedia.org/wiki/Continuation_passing_style#Continuations_as_objects - trashgod