How do I make a JMessageDialog not force the user to close it before switching panels in my GUI?

507 views Asked by At

In my GUI's instructions panel, I have a message dialog appear (when a user clicks on a corresponding button with the instructions for decrypting a type of cipher. However, it forces the user to press "okay" (thus closing the dialog) before switching to the Game panel from the Instructions panel.

My problem is that I want the user to be able to access this message dialog while in the Game panel (basically just open it in the instructions panel and then be able to switch to the game panel with it still open). Is there a way to do this?

1

There are 1 answers

1
Paul Samsotha On

You need to make a custom non-modal JDialog.JOptionPanes are by default modal meaning they block out other input in other components. Take a look at How to Make Dialogs