I have the following code:
public static void main(String args)
JDialog myDialog = new JDialog((JFrame)null, true);
In the first line I make sure that the dialog is modal, this is to make sure dispose is not called before the dialog is hidden.
Then I show the dialog,
and then I dispose it.
Lastly I make a println.
What I would expect:
I would expect a dialog to appear on the screen, with the possibility to close it on the close button of the window (upper right corner in windows).
After I close the dialog, I would expect to see the message "Out" printed,
and lastly the program to terminate.
What is wrong:
The program does print "Out" after closing the dialog, but never terminates.
What am I missing here?
Slight modification I have tried, with the same result:
Before the show, I add:
myPanel has a button, and upon clicking it, the dialog is hidden, "Out" is printed, but the program doesn't terminate:
private void clickButtonQuit()
Component comp = this;
while (comp!=null && !(comp instanceof JDialog)) comp = comp.getParent();
if (comp==null) return;