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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:16:08+00:00 2026-05-30T22:16:08+00:00

I hava jframe1 and jframe2 which extends javax.swing.JFrame in netbeans.(in the same project). jframe2

  • 0

I hava jframe1 and jframe2 which extends javax.swing.JFrame in netbeans.(in the same project).

jframe2 has a jpanel1. What is the wise way to share data between two forms ?

  • 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-30T22:16:10+00:00Added an answer on May 30, 2026 at 10:16 pm

    I guess NetBeans created a panel named jPanel1 inside your Jframe2. The reason why you are getting an error is because NetBeans defaulted jPanel1 accessibility to private and is not visible from the outside world. You should change its accessibility to public if you want to do that.

    A more elegant way: you could add a method to JFrame2 to take care of adding a button to its visual appearance. Something along these lines:

    public class JFrame2 extends JFrame{
      //... 
      public void addButtong(JButton button){
         jPanel1.add(bt);
      }
    }
    

    and use it like this:

    JButton bt = new javax.swing.JButton();
    bt.setText("from jframe1 button1");
    Jframe2.addButtong(bt);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hava java swing project which is developed in JBuilder IDE. Now I need
I am struggling controlling my components. I hava a JFrame which contains a JPanel.
I hava a base type (A) which has two derivatives (B and C). The
I hava a project which will look like similar to Paint program. Here, I'm
I hava a JFrame with multiple JPanels of similar width aligned one below other.
I am developing a Java Desktop Application with GUI implemented in SWING. I hava
I hava a data window object, in which I am fetching some attributes from
I hava a website with a navigation bar which consists of several tabs. Now
I hava 2 listvies on the same activity list1 and list2. I want to
I hava an aspx page and I need to response.redirect to the same page.

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.