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 6 of 6

Thread: close original frame

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default close original frame

    I have a frame (frame1) containing a button linking to another frame (frame2).
    when I click the button I want the first frame to close
    I've tried frame.setVisible(false);
    It didn't work any suggestions?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: close original frame

    dispose?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: close original frame

    I meant Close the original frame

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: close original frame

    What does "close" mean?

    What happened when you used dispose() or setVisible()?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Dec 2013
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: close original frame

    I want the original frame to close automatically after the second frame pops up

  6. #6
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: close original frame

    Add a component listener to the second frame, and when the frame is being shown dispose the first frame.

Similar Threads

  1. Replies: 1
    Last Post: June 20th, 2013, 01:45 PM
  2. How to close a frame on a button click ??
    By rk0887 in forum AWT / Java Swing
    Replies: 1
    Last Post: August 22nd, 2012, 08:58 AM
  3. Replies: 1
    Last Post: January 19th, 2012, 03:44 PM
  4. [SOLVED] Set Invisible or close a frame
    By Souperk in forum Java Theory & Questions
    Replies: 9
    Last Post: November 30th, 2011, 11:56 AM
  5. Opening a new frame on close.
    By Zein in forum Java Theory & Questions
    Replies: 1
    Last Post: August 24th, 2011, 03:25 PM

Tags for this Thread