Connecting JFrames in Netbeans

M

Mithil

Hi Everyone,
I am using NetBeans to do a project and i was
wondering whether i could do the follows:

have 2 files :
one.java ----------> has JFrame1 -----------> has button1,textbox1
two.java ----------> has JFrame2

and when button1 in JFrame1 is clicked JFrame2 should appear and the
value entered in textbox1 is to be sent to two.java so JFrame2 can use
it. Is this possible if so plz help me ASAP thanks for your help in
advance. Any other suggestion arround this problem would be greatly
appreciated as well.
 
J

John O'Conner

Mithil said:
and when button1 in JFrame1 is clicked JFrame2 should appear and the
value entered in textbox1 is to be sent to two.java so JFrame2 can use
it. Is this possible if so plz help me ASAP thanks for your help in
advance. Any other suggestion arround this problem would be greatly
appreciated as well.


You can create a frame and populate its component values *before* you
call setVisible(true).

SecondFrame sf = new SecondFrame();
sf.setSomeValue(textOrOtherValue);
sf.setAnotherValue(someText);
sf.setVisible(true);

If the other frame needs to be modal and is just collecting information
temporarily, maybe a dialog is appropriate.
 
Joined
Sep 6, 2012
Messages
1
Reaction score
0
What if I need to connect another JFrame from a previous one and I don't need the initial one to stay visible, what code do I use pls?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top