Waiting for a dialog to close
I created my own file chooser (for choosing remote files) and need to cause execution to "pause" while the user is looking for a file (while the file chooser dialog is still open) just like JFileChooser.showOpenDialog() does.
Here is what my code looks like (somewhat):
RemoteFileChooser fileChooser =new RemoteFileChooser(this,true);
fileChooser.showOpenDialog();
RemoteFile f = fileChooser.getSelectedFile();
The problem is that the third line is executed immediatly after the dialog is opened. I need it to be executed only after the fileChooser dialog has closed.
I know that this can be done by using a separate thread to show the dialog and by making the main thread sleep while the dialog is open, but would like to, if possible, keep my code as simple as possible (no multithreading). I looked through JOptionPane's source code to find out how it (and JFileChooser) pause the execution but couldn't find anything (with my level of understanding).
I've also searched these forums and Google but all I get is people talking about modal dialogs (which are what I am already using) and extremely unclear explanations. Any help on this would be greatly appreciated.
Thanks

