The Goal
Keep walking……
posts - 23,  comments - 1,  trackbacks - 0
ProgressBar,进度条,是ProgressIndicator的简化版本。大多数情况下推荐使用ProgressIndicator。如果你决定直接使用ProgressBar,需要手动改变此bar的外观。如下

//Style can be SMOOTH, HORIZONTAL, or VERTICAL
ProgressBar bar = new ProgressBar(parent, SWT.SMOOTH);
bar.setBounds(10, 10, 200, 32);
bar.setMaximum(100);
...
for(int i = 0; i < 10; i++) {
//Take care to only update the display from its
//own thread
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
//Update how much of the bar should be filled in
bar.setSelection((int)(bar.getMaximum() * (i+1) / 10));
}
});
}

setSelection()causes the widget to be updated every time.This behavior is unlike that of ProgressIndicator or ProgressMonitorDialog,which will update the display only if it has changed by an amount that will be visible to the end user.
posted on 2006-04-10 17:56 JOO 阅读(405) 评论(0)  编辑  收藏 所属分类: SWT & JFace IN ACTION

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


网站导航:
 
Hit the target!

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

常用链接

留言簿(2)

随笔分类(23)

随笔档案(22)

文章档案(1)

相册

Neighbor

搜索

  •  

最新评论

阅读排行榜

评论排行榜