• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Application Modal JDialog is blocking its child JDialog

 
Ranch Hand
Posts: 35
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've looked around and can't find any answer to this question.

I have an application with a series of JDialog objects. These are created and managed individually and one of them, on the click of a button, needs to open up a child JDialog which in turn asks the user for some data, etc.

The parent is Application Modal and so is it's child JDialog that I am creating when the button is pressed.

The problem is that the child dialog pops up but is being blocked by it's parent and not accepting any focus or commands. Killing the parent also kills the child.

I am looking for behaviour similar to a call to the JFileChooser class which pops up the file chooser dialog and that dialog actually blocks the parent that spawned it until you close it.

Any ideas on how to get my modal parent to play nice with it's modal child?

Thanks in advance.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have an answer for you, except that I find user interfaces which cascade through a bunch of dialog boxes to be rather irritating. It seems that I'm not alone in this because typically you see the "wizard" style of interface where all of the steps appear in the same box. Perhaps you might consider this: it would at least make your existing problem go away.
 
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree that a code example of the problem would be helpful.

You say the child JDialog is also modal and I assume that user input of some kind is expected. Does the child JDialog and/or its components have the necessary ActionListeners attached and actionPerformed() method defined?
 
Rob MacKay
Ranch Hand
Posts: 35
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the child dialog does contain all of the listeners, it just won't accept focus from the parent.

I do agree with the other poster that cascading dialogs are somewhat annoying so I will probably try to contain everything in a single panel. Certainly it'll be a little easier then trying to manage popups that require user input like this.

Strange though that a simple call to a JFileChooser works as expected.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure the dialog has the right parent window? An SSCCE would still help. In this case, all the SSCCE would need is:
- a main JFrame
- with a button
- that creates a first modal dialog when clicked
- which contains a button
- that creates the second modal dialog when clicked
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic