Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Task Progress Bars in Swing

I need a very simple (skeletal) tutorial on progress bars for developing a GUI in Java. The progress bar can be "indeterminate" and ideally have an updateable text label.

Here is some skeletal code that I hope someone can expand upon just enough to get something working.

class MyFunView extends FrameView {

  // class vars and other stuff...

  @Action
  public void excitingButtonPressed() {

     /* I have n files to download */
     // Download file 1, set progress bar status to "downloading file 1"
     // ...
     // Download file n, set progress bar status to "downloading file 2"

  }

} 

Basically, how and what do I wrap my download code in? (I understand there is some kind of subclass of Task required?)

Thanks much in advance.

EDIT:

We all only have so much precious time to be alive, and no approach can be done in as little code or time as I would have hoped, so I will not be using a progress bar.

like image 427
Bill VB Avatar asked Apr 23 '26 11:04

Bill VB


1 Answers

I need a very simple (skeletal) tutorial on progress bars for developing a GUI in Java.

  • How to Use Progress Bars

  • Concurrency in Swing

  • Initial Threads

  • Event Dispatch Thread

  • SwingWorker

  • examples here

like image 71
mKorbel Avatar answered Apr 25 '26 00:04

mKorbel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!