The Goal
Keep walking……
posts - 23,  comments - 1,  trackbacks - 0
同ProgressIndicator一样,它支持工作的虚拟单位,you need only initialize the ProgressIndicator with the total amount of work you expect to do and notify it as work is completed:

ProgressIndicator indicator = new ProgressIndicator(parent);
...
indicator.beginTask(10);
...
Display.getCurrent()display.asyncExec(new Runnable() {
public void run() {
//Inform the indicator that some amount of work has been done
indicator.worked(1);
}
});

正如上例所示,使用ProgressIndicator需要2步:
1.让indicator知道总共有多少工作,通过使用beginTask().只有这个方法被调用了之后,这个control才会在屏幕上显示。
2.每当有一部分工作被完成了,就调用worked()。为了防止非ui的线程来update widgets,所以使用asyncExec()来解决这个问题。

ProgressIndicator也提供animated模式,即总工作量不知道的情况。在这种模式下,the bar continually fills and empties
until done() is called. 要使用这个模式,就要用beginAnimatedTask()代替beginTask();并且不需要worked()方法了
posted on 2006-04-10 18:07 JOO 阅读(569) 评论(0)  编辑  收藏 所属分类: SWT & JFace IN ACTION

只有注册用户登录后才能发表评论。


网站导航:
 
Hit the target!

<2006年4月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

常用链接

留言簿(2)

随笔分类(23)

随笔档案(22)

文章档案(1)

相册

Neighbor

搜索

  •  

最新评论

阅读排行榜

评论排行榜