views:

38

answers:

1

Below is the code I am using to display a gauge 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();
}
A: 

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.

mopoke
When i remove the else statement, like you say.. nothing is printed to the screen..
Jaron787
I need that method to start, only once the this.count(); method has finished.. I am unsure how you do this?
Jaron787
Without knowing exactly how your code works, I'd suggest that you find an appropriate point where you start counting and insert your first progress_Result.setText() call in there.
mopoke