Can I use a Java JOptionPane in a non-modal way?

后端 未结 5 1494
一向
一向 2020-11-30 10:03

I am working on an application which pops up a JOptionPane when a certain action happens. I was just wondering if it was possible that when the JOptionPane does pop up how c

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-30 10:50

    This easy tweak worked for me (1.6+). Replaced the showXXXDialog with four lines of code to: (1) create a JOptionPane object (2) call its createDialog() method to get a JDialog object (3) set the modality type of the JDialog object to modeless (4) set the visibility of the JDialog to true.

提交回复
热议问题