How can I make my application pause when I open custom JDialog and after the dialog is closed to make continue again.
Simply use:
setModal(true);
I usually call it from within the constructor of the JDialog.
JDialog
See the Javadocs on setModal(boolean). http://java.sun.com/javase/6/docs/api/java/awt/Dialog.html#setModal(boolean)
setModal(boolean)
That will cause execution to block on the current thread until the dialog box closes.
Alternatively, you can use:
setModalityType(Dialog.DEFAULT_MODALITY_TYPE);
It is equivalent to setModal(true) and technically the correct way to do it.
setModal(true)
2.1m questions
2.1m answers
60 comments
57.0k users