GilaMonster
asked on
20 easy points, Re: closing Frames
I have had the most trouble closing my Frames. I know the Frame ignores the Event.WINDOW_DESTROY. So without using System.exit(0), how can I get my Frames to close?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What platform and JDK version are you running under?
Since a Frame is derived from Window, which is derived from container which is derived from component, you might want to try:
YourFrame.getParrent().rem ove(YourFr ame);
and see if that works.
YourFrame.getParrent().rem
and see if that works.
ASKER
Your I have tried your suggestions. Here is the code that I thought would do the job; however, when I hit the 'X' in Win 95 to close the frame nothing happens.
Thanks
public boolean handleEvent(Event event)
{
if (event.id == Event.WINDOW_DESTROY)
{
hide(); // hide the Frame
dispose(); // free the system resources
System.exit(0); // close the application
return true;
}
return super.handleEvent(event);
}