How can I make my application paused when I open a custom JDialog and after closing the dialog to continue.
Just use:
setModal(true);
I usually call it from the JDialog constructor.
JDialog
See Javadocs on setModal(boolean) .http://java.sun.com/javase/6/docs/api/java/awt/Dialog.html#setModal(boolean)
setModal(boolean)
This will force execution to block the current thread until the dialog box closes.
Alternatively you can use:
setModalityType(Dialog.DEFAULT_MODALITY_TYPE);
This is equivalent to setModal(true) and technically the correct way to do this.
setModal(true)
See the JDialog constructor http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JDialog.html#JDialog(java.awt.Dialog,%20java.lang.String,%20boolean) . You can set the modality of this dialog. Setting modal = true pauses your application. you can also use the 'setModal' method http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Dialog.html#setModal(boolean)