Connecting JFrames in Netbeans

Discussion in 'Java' started by Mithil, Nov 16, 2006.

  1. Mithil

    Mithil Guest

    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.
     
    Mithil, Nov 16, 2006
    #1
    1. Advertising

  2. Mithil wrote:

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

    --
    John O'Conner
     
    John O'Conner, Nov 24, 2006
    #2
    1. Advertising

  3. Mithil

    SamieDee

    Joined:
    Sep 6, 2012
    Messages:
    1
    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?
     
    SamieDee, Sep 6, 2012
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lukasz Indyk
    Replies:
    6
    Views:
    512
    Andrew Thompson
    Jan 23, 2004
  2. Lynx

    Two JFrames, one dialog

    Lynx, Nov 7, 2004, in forum: Java
    Replies:
    2
    Views:
    589
    Larry Barowski
    Nov 8, 2004
  3. rfractal30
    Replies:
    0
    Views:
    2,356
    rfractal30
    Apr 11, 2005
  4. rfractal30
    Replies:
    1
    Views:
    470
    rfractal30
    Apr 14, 2005
  5. rfractal30
    Replies:
    0
    Views:
    381
    rfractal30
    Apr 13, 2005
Loading...

Share This Page