?
Solved

20 easy points, Re: closing Frames

Posted on 1997-05-29
4
Medium Priority
?
217 Views
Last Modified: 2010-04-16
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?
0
Comment
Question by:GilaMonster
  • 3
4 Comments
 
LVL 6

Accepted Solution

by:
jpk041897 earned 40 total points
ID: 1221087
Call the frames dispose() method.

dispose() destroys the frame. If thats not what you want, then you can call its diasable(true)  and setVisible(false) methods.
0
 

Author Comment

by:GilaMonster
ID: 1221088
Thanks for the quick reply.

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);
   }
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1221089
What platform and JDK version are you running under?
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1221090
Since a Frame is derived from Window, which is derived from container which is derived from component, you might want to try:

YourFrame.getParrent().remove(YourFrame);

and see if that works.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
This video teaches viewers about errors in exception handling.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month17 days, 13 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question