I want to disable clicking on the background panel or frame while showing a dialogue. And I want the dialogue to appear on top of this panel or frame constantly until it is closed.
How can I do this?
Make Dialog/JDialog modal by calling dialog.setModal(true);
. This will solve both issues of clicking background panel and remaining on top of panel.
It seems like this method is obsolete so better you should use dialog.setModalityType(Dialog.ModalityType type)
You can use JOptionPane
for the message dialog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With