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 ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
I guess NetBeans created a panel named
jPanel1inside yourJframe2. The reason why you are getting an error is because NetBeans defaultedjPanel1accessibility to private and is not visible from the outside world. You should change its accessibility topublicif you want to do that.A more elegant way: you could add a method to
JFrame2to take care of adding a button to its visual appearance. Something along these lines:and use it like this: