I believe
you should use a modal dialog/form. When you call
setVisible(true) on a modal form, the
setVisible call won't return until the modal dialog is closed, hidden or destroyed. This means you don't have to add any window closing event manually. See the
modality in Swing tutorial.
Edit: we're now strictly in the Swing territory, so I've added this
thread to the Swing forum as well.