1,105,585 Community Members

Java GUI + Netbeans. Calling another JFrame Form from one..

Member Avatar
rahulrulez
Newbie Poster
19 posts since Feb 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hello,

I've created a Button in one form. I've to make it work like, if I click on that button it should open another JFrame Form or JPanel form which I've created as addStock.java..

I don't know how to trigger this action..


Anyone can help me?

Regards,
Rahul.

Member Avatar
hiddepolen
Posting Whiz in Training
293 posts since Oct 2010
Reputation Points: 32 [?]
Q&As Helped to Solve: 36 [?]
Skill Endorsements: 1 [?]
 
0
 

Add this in the method you want to launch your JFrame in.

JFrame frame = new JFrame("Title");
frame.setDefaultClose(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.add(new JLabel("new window!"));
Member Avatar
rahulrulez
Newbie Poster
19 posts since Feb 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

^ What if I've some JFrame created in separate .java files.


E.g. I've a file (Which is JPanel) called MainScreen.java, I've created a button on it. When a user clicks on that button, it should open a JFrame present in other .java file i.e. addStock.java

How to implement such situation?

satdude
Newbie Poster
1 post since Dec 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
-1
 

i have the same problem can somebody help

Member Avatar
stultuske
Posting Expert
5,325 posts since Jan 2007
Reputation Points: 938 [?]
Q&As Helped to Solve: 776 [?]
Skill Endorsements: 35 [?]
Featured
 
1
 

satdude, this thread is over a year old. if you have a problem, please start your own thread and be a bit more specific.
in a lot of "I have the same problem" posts, it turns out that even though it "seems" related, it's not.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article