views:

1498

answers:

3

Hello, I have created one GUI in which I have used a JFrame. How should I make it Modal?

+3  A: 

Your best bet is to use a JDialog instead of a JFrame if you want to make the window modal. Check out the Modality API for details.

akf
A: 

As far as I know, JFrame cannot do Modal mode. Use JDialog instead and call setModalityType(Dialog.ModalityType type) to set it to be model (or not a modal).

NawaMan
A: 

This should help you:

http://www.javareference.com/jrexamples/viewexample.jsp?id=44

Althought if possible, use a JDialog, as it can be modal

David Menard