0

I want to update JProgressBar when jButton1 is activated, but it does not change until the FunctionX() is completed.

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    jProgressBar1.setValue(10);
    jProgressBar1.setValue(20);
    FunctionX();
}
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • 2
    The Oracle tutorial, [How to Use Progress Bars](https://docs.oracle.com/javase/tutorial/uiswing/components/progress.html), will show you how to use a JProgressBar. – Gilbert Le Blanc Sep 05 '21 at 20:34
  • 2
    [JProgressBar isn't progressing](https://stackoverflow.com/questions/12020949/jprogressbar-isnt-progressing/12021971#12021971). Generally, I'd use a `SwingWorker` as it has a number of useful features which make this, otherwise complex problem, somewhat eaiser – MadProgrammer Sep 05 '21 at 22:50
  • 1
    Don't tag the IDE, it is irrelevant to the problem. – Andrew Thompson Sep 06 '21 at 00:43
  • 1
    Does `FunctionX()` preform a long process ? (BTW following java naming conventions it should be `functionX()`) – c0der Sep 06 '21 at 04:16

0 Answers0