1

下面是我用来显示从 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();
}
4

1 回答 1

0

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

于 2010-01-05T20:56:12.543 回答