This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Multiple Modal Dialog's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Multiple Modal Dialog Watch "Multiple Modal Dialog New topic
Author

Multiple Modal Dialog's

Its Just Me
Greenhorn

Joined: Jan 10, 2002
Posts: 21
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...
 
 
subject: Multiple Modal Dialog's