ProgressBar Word Counter problem
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
.
精彩评论