Can I lock JFrame
, when another appears ? Something like when you want open new file, the main window is locked.
Asked
Active
Viewed 6,050 times
2

jellyfication
- 1,595
- 1
- 16
- 37

Michal
- 65
- 2
- 9
-
4http://stackoverflow.com/questions/1481405/how-to-make-a-jframe-modal-in-swing-java – BobTheBuilder Feb 11 '13 at 14:46
-
See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556) – Andrew Thompson Feb 12 '13 at 11:08
-
^ Summary: bad practice – RyanS Dec 21 '14 at 20:14
2 Answers
6
this not possible with JFrame
, JFrame
haven't modality methods, have to use JDialog
, with follows parametes
don't forget to set
setParent
fromJFrame
toJDialog
or to use JOptionPane
, block code execution, waiting for users action

mKorbel
- 109,525
- 20
- 134
- 319
5
Use modal dialogues, the ones that block the underlying JFrame

Boris Pavlović
- 63,078
- 28
- 122
- 148
-
I tried use this modal stuff, but already not working (try exapmles from oracle's link). – Michal Feb 12 '13 at 11:32