• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDialog setModal() hierarchy  RSS feed

 
Chris-Huisman
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My JFrame instantiates a JDialog, which I want to be modal, for that JFrame. When I make the JDialog modal, it does not let me get to it's parent (which is good), but I cannot interact with the JDialog's parents parent either (which is bad).
How do I make a JDialog modal to only it's immediate parent?
Thank you,
c.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDialogs are modal to all top-level components that are their ancestors (as you have discovered). You'll have to "break the chain" at the point that you don't want the dialog to be modal anymore. Just leave out the parent parameter in the constructor of the parent of the dialog. Do you really need the "grandparent" frame to be the parent of the parent of the dialog?
 
foo char
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys I am having the same problem (using 1.4 hehe). If anyone could expand on how one would "break the chain" - that would be awesome. Thanks !
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!