2

Can I lock JFrame, when another appears ? Something like when you want open new file, the main window is locked.

jellyfication
  • 1,595
  • 1
  • 16
  • 37
Michal
  • 65
  • 2
  • 9

2 Answers2

6

this not possible with JFrame, JFrame haven't modality methods, have to use JDialog, with follows parametes

  1. setModal(true) or

  2. setModalityTypes()

  3. don't forget to set setParent from JFrame to JDialog

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