This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Multiple Modal Dialog's

Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
it may be simple to you, but I have the following problem.
I have a modal java.awt.Dialog. After a specified amount of time it creates another modal java.awt.Dialog, using a Thread.
Both Dialogs have a refference to the same parent (Frame).
Some time later, the second Dialog dissappears automatically, and again after some time it pops up again.
The problem is: I want both Dialogs to be modal. I know what you are thinking: they can't both be modal at the same time! I know that, but trying to transfer the "modality" (is this a word?) when the second Dialog dis- or appears, using the setModal(boolean)-method, seems not to be possible. Basically, this is what I do (wrong?):
1. create a modal java.awt.Dialog dialog1
2. after some time: dialog1.setModal(false);
3. create the other modal java.awt.Dialog dialog2
4. after some time: dialog2.setModal(false);
5. dialog2.dispose();
6. dialog1.setModal(true);
7. loop back to step 2.
this is what happens : the first Dialog shows up and is modal. Then the second one comes up, also modal. When the second Dialog disappears, the first one (which was still vissible in the background) is no longer modal.
What can I do to prevent this form happening? I want the Dialog's to "take turn at being modal"!
Please help...
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!