jQuery in Action, 2nd edition*
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Multiple Modal Dialog Watch "Multiple Modal Dialog New topic

Multiple Modal Dialog's

Its Just Me

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...
I agree. Here's the link: http://aspose.com/file-tools
subject: Multiple Modal Dialog's
Similar Threads
JDialog Dilemma I Have
Modal Dialog
All Netscape/Mozilla windows blocking with Modal Dialogs
key listener not detected
Problem when multiple dialogs popped up at the same time?