• 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Frame not closing when parent is closed

Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I have a quick question, I have added a frame to my application that opens when you click on a certain button, but when the parent frame is closed the frame I created remains open.
How can I make sure, that when the user closes the parent frame(the application) my frame also disposes?

Thanks a lot in advance, I apreciate your time.
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all i advise you to use a jDialog instead of a frame.. However it doesn't matter much.. you can setvisible or hide it using your main code.. If you want to make your program neat.. Here are few steps.. These are just what I think is the best..

1. Once you create or setVisible() a new frame or dialog disable the underlying frame's active components and enable them only once the new frame is closed(better just hidden). so that the user won't be doing stuff you don't want him to do.. With this done the user will have to close the new frame first in order to close the underlying frame.

2. Stick to step number 1..

3. follow step number 2.. K.. Hope you got it now..

As far as manourevability(or whatever) is concerned it's always better to hide new frames or dialogs using your own event.


In your case.. all you got to do is override the exit method() which is a big deal.. There's got to be some other easy way out.. K.. Never came up with such shit before.. Or you can perhaps use something like netbeans or eclipse to do the GUI work..
[ January 17, 2007: Message edited by: Malith Yapa ]
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic