开发者

ProgressBar Word Counter problem

开发者 https://www.devze.com 2022-12-15 08:03 出处:网络
Below is the code I am using to display a ga开发者_开发问答uge progressbar from 0 - 100 whilst counting the number of words from a website. When it has finished counting the number of words i.e. when

Below is the code I am using to display a ga开发者_开发问答uge progressbar from 0 - 100 whilst counting the number of words from a website. When it has finished counting the number of words i.e. when it has reached 100 I want it to display some text. However using the code below all I get is the else statement printed because it is still counting while the gauge check method is called. How do I get around this?

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();
}


I suggest that you call progress_Result.setText("The number of words has not been successfully counted"); only once when you first initialize your gauge. Then remove the else clause from GaugeCheck.

0

精彩评论

暂无评论...
验证码 换一张
取 消