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.
 
Ad

Advertisements

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.
 
Ad

Advertisements

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?
 

Top