标签:
btnNewButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { new Thread(new Runnable(){ @Override public void run() { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } // Display.getCurrent().asyncExec(new Runnable(){//null point current thread is not ui thread shell.getDisplay().asyncExec(new Runnable(){ @Override public void run() { text.setText("我特么是异步的!!!???"); } }); } }).start(); } });
需要实现异步UI刷新效果(WEB中的数据推送) 需要通过以下模型来实现(不过这个模型是阻塞式的交互效果并不好)
container.getDisplay().timerExec(0, new Runnable(){ @Override public void run() { display.timeExec(1000,this); } });
标签:
原文地址:http://www.cnblogs.com/wykCN/p/5009444.html