I have the following fun
which will be executed by non event dispatching thread. In the middle of thread, I want a
Contrary on the popular belief you dont need to dispatch to AWT (EventQueue) thread to show the dialog. So just show it.
When you do JOptionPane,showMessge() your thread (Thread.currentThread()) is going to do wait(), and the dialog will pop up. Use the result after showMessage and you're good to go.
Thus:
choice = JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION);