0

How can stop duplicate of JDialog opening up upon clicking JButton twice or more?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
user1708134
  • 643
  • 1
  • 9
  • 21
  • not wrong desing, not good idea, create only one `JDialog` and re_use for next event from `JButton` – mKorbel Oct 06 '12 at 21:51

1 Answers1

5

You can:

  1. Make that dialog modal.

  2. Use a boolean flag to indicate whether the dialog was already opened or not. Set when opening, clear when dialog is closed.

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674