Java GUI JProgressBar not painting

前端 未结 3 1854
独厮守ぢ
独厮守ぢ 2020-12-11 23:50

I have a GUI problem that I would like to get sorted out, but I am baffled as to what\'s happening and hope one of you can explain it. The code base is way too large to upl

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 00:12

    The reason it doesn't update is because your UI thread is busy in the ActionPerformed listener doing processing. If you try and interact with your application, you'll notice that nothing on the UI is responsive.

    The solution to this is to not do processing on the UI thread - launch another thread, do the processing on that, and call back to the UI thread to update the progress bar.

提交回复
热议问题