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 7046147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:36:57+00:00 2026-05-28T02:36:57+00:00

i can open a form or another forms when button is clicked in netbeans.

  • 0

i can open a form or another forms when button is clicked in netbeans.
such as the following code

private void button1ActionPerformed(java.awt.event.ActionEvent evt) {                                               
    frame1 fr = new frame1();
    desktop.add(fr);
    fr.setVisible(true);}

but i want to control that is current form is open or close? if current form is open then when i click same button not open current form again until its closed the same form. how can i make it? there is some methods like isclosed(), isDisplayable(), but i dont khow how can i use these? please give me advice.

  • 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-28T02:36:57+00:00Added an answer on May 28, 2026 at 2:36 am

    You could use Boolean variables to determine whether or not the allowance of opening a frame.

    example:

    //declaring the boolean in a class in which both frames can access
    public final class Allow {
        private Allow(){}
        public static Boolean allow_ = true;
    }
    

    In your main frame code where you open the secondary frame you can do this

    if(Allow.allow_ == true) {
        Allow.allow_ = false;
        secondFrame sFrame_ = new secondFrame();
        sFrame_.setVisible(true);
    } else {
        //alert the user that the frame is already open
        //I recommend a JOptionPane such as this
        JOptionPane.showMessageDialog(null, "This window is already open");
    }
    

    So now the second frame is open, and now it will only let you open it if allow_ is true.

    Now when you close the second frame you do this:

    Allow.allow_ = true;
    secondFrame.this.setVisible(false);
    secondFrame.this.dispose();
    

    Now the second frame is closed, and will now be allowed to be opened once again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that uses a form.submit() to open up another window when
I have a form that can open a sub form (with ShowDialog ). I
How can I ensure that this does NOT open in a new window?? onclick=ob=this.form.table;window.open(ob.options[ob.selectedIndex].value)/>
I have MySQL running such that I can open a client command line and
I've got a form and a button on it. I would like to open
Access can open DBF (dBase) files, but instead of physically converting the data into
I can open the DefaultTemplate.xaml that was installed as part of our TFS 2010
In flash you can open a file on the user's computer. In flash 9
I realise that you can open the google maps app ready for directions by
If I can open a connection to an MS Access file in C#, how

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.