Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Opening new JFrame

 
Vinnie Jenks
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to Swing and I'm trying to do something simple which isn't quite working the way I'd expect.

I've got a JFrame which is launching another JFrame through an actionPerformed event.

Here's the "master" JFrame:



This loads up the Entries JFrame just fine...however if I click the X in the corner of the window - it tanks the entire application and takes the parent JFrame down with it.

An alternative would have been to disallow "decorations" so there was no X button and provide a button that would setVisible(false)...but that's rather unattractive and I'd like the window decoration to be there...I just want it to behave.

I suspect this has something to do w/ the threading model but I'm unfamiliar and not sure how to prevent this from happening.

Any ideas?

Thanks!
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you called setDefaultCloseOperation(EXIT_ON_CLOSE) on any of your JFrames? That would do what you describe.
 
Vinnie Jenks
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, I hadn't but that did the trick, thank you!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!