ProgressBar Word Counter问题

时间:2010-01-05 20:46:22

标签: java-me progress-bar counter

下面是我用来显示0到100之间的仪表进度条,同时计算网站中的单词数量的代码。当它完成对单词数量的计数,即当它达到100时,我希望它显示一些文本。但是,使用下面的代码,我得到的是else语句,因为在调用仪表检查方法时它仍在计数。我该如何解决这个问题?

public void SetGauge(int value) {
    this.gg_Progress.setValue(value);  
}



public void GaugeCheck () {
    if (this.gg_Progress.getValue() == 100) {
        progress_Result.setText("The number of words from this website have been successfully counted");  
    }
    else {
        progress_Result.setText("The number of words has not been successfully counted");
    }
}




if (command == Continue2) {
    // write pre-action user code here
    switchDisplayable(null, getReading());
    // write post-action user code here
    DelimiterCheck(tfd_Delimiter.getString());
    this.Count();
    this.GaugeCheck();
}

1 个答案:

答案 0 :(得分:0)

我建议您在首次初始化量表时只拨打progress_Result.setText("The number of words has not been successfully counted");一次。然后从GaugeCheck中删除else子句。