[nbusers] Re: Calling JFrame from another class

  • From: "Bayless Kirtley" < >
  • To: < >
  • Subject: [nbusers] Re: Calling JFrame from another class
  • Date: Thu, 3 Jan 2013 21:30:19 -0600
  • Authentication-results: cox.net; none
  • Importance: Normal

If your called JFrame is named test1 then you have to instantiate it, not menu1. Code needs to be

test1 menu1 = new test1();
menu1.setVisible(true);

Also, the Java convention is for class names to begin with upper case. Your classes should be named Test and Test1.



-----Original Message----- From: daeva112
Sent: Thursday, January 03, 2013 5:35 AM
To: 

Subject: [nbusers] Calling JFrame from another class


kimp_07 wrote:

Code:
import your_frame_class;



NB automatically organize imports.
after that


Code:
YourFrame frame = new YourFrame();
frame.setVisible(true);

[/code]


Didn't work. Created new class named test1 in the same package named xxx. Ex main class name is test.
type import xxx.test1; on top of class test

added jbutton in test class.

Code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
menu menu1=new menu();
menu1.setVisible(true);}



and NetBeans showed
cannot find symbol
symbol: class menu
location: class test

Btw I have also changed variable modifiers of menu jframe in class test1 to public






-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.2805 / Virus Database: 2637/5977 - Release Date: 12/21/12
Internal Virus Database is out of date.


[nbusers] Calling JFrame from another class

daeva112 01/03/2013

[nbusers] Calling JFrame from another class

kimp_07 01/03/2013

[nbusers] Calling JFrame from another class

daeva112 01/03/2013

[nbusers] Re: Calling JFrame from another class

Bayless Kirtley 01/04/2013

[nbusers] Calling JFrame from another class

daeva112 01/04/2013

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close