0

Here runQuery() function executes a query on 4 databases. I want tprogrssBar value should be updated to 50 on screen before it starts running runQuery() function. But screen gets updated after runQuery() is executed.

public void actionPerformed(ActionEvent e) {
        String s = e.getActionCommand();
        progressBar.setValue(50);
        runQuery();
    }
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Riya
  • 25
  • 6
  • 1
    Don't block the EDT (Event Dispatch Thread). The GUI will 'freeze' when that happens. See [Concurrency in Swing](https://docs.oracle.com/javase/tutorial/uiswing/concurrency/) for details and the fix. – Andrew Thompson Mar 26 '20 at 15:15
  • 1
    Also, simply searching on [java swing why jprogressbar not updating](https://www.google.com/search?q=java+swing+why+jprogressbar+not+updating) will bring you the answer. – Hovercraft Full Of Eels Mar 26 '20 at 15:16

0 Answers0