Hi guys,
Consider the following code:
MyDialog dialog = new MyDialog(parent);
dialog.setVisible(true);
// may the dialog was disposed before the following line gets executed
dialog.getVariableValue();
dialog.dispose();
Suppose the MyDialog extends JDialog and have a member variable which can be accessed by getVariableValue() method.
A dialog appears, enter something which is stored by a member variable of the MyDialog class. Then close the dialog by invoking dispose() method. After the dialog disappears, the next line dialog.getVariableValue() can get the entered value.
I thought that the dialog will be null after dispose() gets called, but actually not.
Is the current thread stopped at the line dialog.setVisible(true) and wait for the dialog to be closed?
Can anyone explain?