How can I create a modal JDialog, that blocks only the owner (JFrame or JDialog) and not the whole application (or applet)?
Created May 4, 2012
Sandip Chitale You could use a non-modal dialog -
Steps are -
- Add a WindowListener to the JDialog. In the windowClosed(WindowEvent we) "enable" the JFrame.
- Before showing the JDialog disable the JFrame.
- Show the JDialog.
Yes, I have been also annoyed by the flip-flops in the behaviour of modal dialogs. In fact making it Application modal is almost a death nail for SDI applications. Sun is going to support degree of modality in future version (JDK1.4 I think).
Davanum Srinivas adds
You can extend the Semi-Modal concept as described in JavaTip-89 at:http://www.javaworld.com/javaworld/javatips/jw-javatip89.html
This involves manipulating event queues to handle the Keyboard and Mouse events.