1

I just want to implement a status dialog. How to show a JDialog which blocks the user input but allow the parent window processing its own work?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Sanjeev
  • 397
  • 1
  • 8
  • 20

3 Answers3

3

You can use a modal JDialog or JOptionPane (which really is nothing more than a specialized modal JDialog) for this, just be sure to

  • the work is not to be done in a parent "window"
  • but rather it should be done in a background thread
  • and this thread should be started prior to setting the dialog visible.
  • Use a SwingWorker for this background thread, and then your dialog can display quantitative progress information by adding a PropertyChangeListener and having the SwingWorker update its progress property.
Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
2

You can create and customize different kind of dialog using JOptionPane. Have a look at JOptionPane Features. Also, have to look at

Sujay
  • 6,753
  • 2
  • 30
  • 49
mKorbel
  • 109,525
  • 20
  • 134
  • 319
2

JOptionPane with JOptionPane.showXXXDialog(); static methods, what else ?

air-dex
  • 4,130
  • 2
  • 25
  • 25