0

I have created a GUI having one JButton and some other components. When I click the button, some back end processing is involved which takes nearly 10-12seconds.

How should I represent it graphically?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
svkvvenky
  • 1,122
  • 1
  • 15
  • 21
  • I have tried some splash screen kind of.But i am getting it only when my application is loading initially.I want to represent some thing like splash screen showing "processing...."info – svkvvenky Sep 14 '12 at 05:40
  • 1
    See [this answer](http://stackoverflow.com/questions/8916721/java-swing-update-label/8917565#8917565) – Robin Sep 14 '12 at 06:09

1 Answers1

3

Use a JProgressBar for displaying the progress of the task.

JProgressBar at 52%

Put it inside a non-modal dialog that has a 'cancel' button (if the long running operation can safely be cancelled).

Be sure to obey the rules of the EDT by performing the long running task 'off the EDT', while the updates to the progress bar are done 'on the EDT'. The SwingWorker offers easy access to both.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433