Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Frame not closing when parent is closed  RSS feed

 
aymane chetibi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • 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.
regards,
 
Malith Yapa
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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.

OR

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 ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!