• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Multiple Modal Dialog's

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
What a show! What atmosphere! What fun! What a tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic