好像是第二次遇到这个网站,激动的注册了个账号,很喜欢的一种风格~新人来报道,多多指教
最近在实践一些桌面程序,一直里不太清楚UI与业务线程的互操作问题
最近在实践一些桌面程序,一直里不太清楚UI与业务线程的互操作问题
1
yaohonv OP // 定义一个带定时的线程
final ScheduledExecutorService timer = Executors .newScheduledThreadPool(1); final Runnable beeper = new Runnable() { public void run() { if (shell.isDisposed()) timer.shutdown(); display.syncExec(new Runnable() { public void run() { DirectMessageParam temp = ConWeibo .getNearDirectMessage(weibo, dmp.getNearestID(), 1375764302); if (null != temp) { text1.insert(temp.getContent() + "\r\n"); dmp = temp; } } }); } }; timer.scheduleAtFixedRate(beeper, 1, 5, TimeUnit.SECONDS); |