Search code examples
javaswingjframejoptionpane

JOptionPane.showConfirmDialog blocks the background windows


JOptionPane.showConfirmDialog popup (Y/N dialogues) blocks accessing other windows of the same application. (needless to mention I know it is the nature of this dialogue to bock other windows, however I dont want it for this app). In an application I open several jframes in each an image is loaded. Then at the end I ask user whether he/she wants the images to be saved or not. but the user has no access to go back and look at those windows as the JOptionPane.showConfirmDialog does not allow it. How can I set up JOptionPane.showConfirmDialog so that I still have access to the underneath windows?


Solution

  • The JOptionPane dialogs are "modal" which means they intentionally block other windows, forcing the user to make a decision before continuing.

    Try JDialog instead and setModal() to false.