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 閱讀(592) 評論(0)  編輯  收藏 所屬分類: SWT & JFace IN ACTION
          Hit the target!

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

          常用鏈接

          留言簿(2)

          隨筆分類(23)

          隨筆檔案(22)

          文章檔案(1)

          相冊

          Neighbor

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 霍邱县| 泰兴市| 察哈| 宿松县| 兖州市| 浦城县| 辽宁省| 佛学| 额敏县| 长汀县| 富川| 韶山市| 曲阳县| 和平县| 西昌市| 安塞县| 大城县| 沈阳市| 阜城县| 灵寿县| 曲周县| 兴隆县| 莎车县| 叶城县| 龙陵县| 鹤庆县| 泌阳县| 德化县| 突泉县| 班戈县| 丽水市| 凉城县| 玛纳斯县| 泸水县| 林甸县| 峨眉山市| 新干县| 德格县| 商都县| 蓝山县| 镇远县|