我正在尝试在程序执行结束前在eclipse swt浏览器中显示文本,例如:
button.addListener(SWT.MouseUp, new Listener() {
public void handleEvent() {
//Trying to print immediately
browser.setText("Example!");
// sleep for test purposes, simulating the program execution
try {
Thread.sleep(2000);
}
catch (InterruptedException e1) {
e1.printStackTrace();
}
// end;
}
});
如上所示,程序等待所有执行以打印“示例!”。