Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: JFrame Exit Problem.

  1. #1
    Member
    Join Date
    Jul 2012
    Posts
    37
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default JFrame Exit Problem.

    I created a class that loads up a JFrame, and that frame has JMenus and JMenuItems.

    One of those JMenuItems opens up a new JFrame, and when you close that JFrame (a customised calculator), the entire program closes, instead of just the 1 JFrame.

    How do I get around this?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: JFrame Exit Problem.

    Don't call the System.exit(0) method. Check if the other JFrames use the setDefaultCloseOperation() method and what args it uses. Some will exit.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. problem with my JFrame; JFrame not closing and stay in background
    By golominator in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 6th, 2012, 07:20 AM
  2. problem with jframe
    By mostafa_mohamed in forum AWT / Java Swing
    Replies: 1
    Last Post: September 7th, 2012, 06:16 PM
  3. jmenu&jframe problem
    By beni.vd in forum AWT / Java Swing
    Replies: 1
    Last Post: January 2nd, 2011, 11:11 AM
  4. Problem with a JFrame method
    By Lakmini Kuruppu in forum AWT / Java Swing
    Replies: 1
    Last Post: May 20th, 2010, 08:40 AM
  5. Change JFrame components problem
    By bruno88 in forum AWT / Java Swing
    Replies: 0
    Last Post: June 30th, 2009, 01:25 PM