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 に答える