Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6557761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:06:57+00:00 2026-05-25T13:06:57+00:00

From first frame I call another frame: frame2 fr2 = new frame2(); fr2.setVisible(true); but

  • 0

From first frame I call another frame:

frame2 fr2 = new frame2();
fr2.setVisible(true);

but when I’m trying to close in the same way – no reaction

frame2 fr2 = new frame2();
fr2.setVisible(false);

All that I do using two buttons on first frame

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:06:57+00:00Added an answer on May 25, 2026 at 1:06 pm
    frame2 fr2 = new frame2();
    fr2.setVisible(false);
    

    by this, you are creating a new instance of frame2 and hiding it and you are not doing anything to the frame2 instance that you have already created and hence no reaction

    What you should do is create a class field or something similar to hold reference to the instance of frame2 you create at first (when you show it) and then use the same reference and call setVisible(false).

    class frame1{
        ...
    
        private frame2 frame2ref;
        ....
    
    
        void foo()
        {
           ....
           frame2ref = new frame2();
           frame2ref .setVisible(true);
           // create and save reference and show frame.
           ...
        }
    
        void bar()
        {
            ...
            frame2ref.setVisible(false);
            // retrieve reference and hide frame. 
            ...
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the syntax... on the first frame JTextField tf1 = new JTextField(); from
i have built a custom class, which i call from a frame script. the
From the first days the .NET framework came out there was a minimum OS
Quote from Head first html: You can add padding to the top and bottom
I am typing code from Head First iPhone Development (O'reilly) and Xcode will build
Is it possible to get the value from the first page to the second
I'm writing a function that fishes out the src from the first image tag
We have a function that pulls the date from the first 8 characters of
When I first switched from Java to C#, I was really impressed with C#'s
First question from me; I'm currently fixing a graphing service that uses XSLFO to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.