Help with JInternal Frames


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Help with JInternal Frames

  1. #1
    Join Date
    Sep 2004
    Posts
    103

    Help with JInternal Frames

    Okay I'm Using JDesktop Pane To create and bring up 3 different frames. Now I want to be able to Enter Data into one frame and then It show Up in another frame.

    I've tried Embedding Actionlisteners but this has not worked
    I've tried setting the objects to public this hasn't worked

    Basically I have the first frame a input frame
    The second frame a Table

    I want to input the data from the input frame into the second frame which is a table

    If you have any idea how to do this, can you should me some code, or please try and explain it to me? Thanks for the help
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    The easiest way would be to supply all your internal frames with a constructor that
    took the main frame as a poniter. So, when you fill in data in one frame and want
    to 'send' this to another internal frame, the internal frame would call the mainframe
    requesting the pointer to the other one and use that for invoking the receival
    method of the other frame.
    Or, as I've shown earlier in this forum, you could have an arraylist in the mainframe
    that your store the pointers to all the internal frames in. If you include this arraylist
    as one of the internal frames constructor's parameters, then the internalframes can
    scan this arraylist to find the other internal frames that they need to 'communicate' with.
    eschew obfuscation

  3. #3
    Join Date
    Sep 2004
    Posts
    103
    "The easiest way would be to supply all your internal frames with a constructor that took the main frame as a poniter. So, when you fill in data in one frame and want to 'send' this to another internal frame, the internal frame would call the mainframe requesting the pointer to the other one and use that for invoking the receival method of the other frame."

    when I take the Main Frame as a pointer as You say, Would I be referencing Jframe or MyDesktopPane


    public JInternalFrame createFrame1(myDesktop m, String t) {

    So would a JInternframe be like this? up Above?

    and Then How would I be able to point the pointer to the text boxes and then have them equal what's in the textboxes?

    Thanks?

  4. #4
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    The mainFrame, cause when it is defined for all the internalframes they can access
    the mainFrames public methods through the pointer, like:

    TabInternalFrame tbFrame=theMainFrame.getTableInternalFrame();

    ...where TabInternalFrame is another internal frame that exists in the application,
    on the desktop. This implies that the mainFrame must store the pointers
    to the internal frames that are created.

    In my example above the mainframe hands the pointer to another frame on
    the desktop to this internalframe, and so it can access the other internal
    frames' textboxes of whatevver, as long as the properties/components are
    made public, either through direct access of via setters and getters.
    Last edited by sjalle; 04-07-2005 at 05:06 PM.

  5. #5
    Join Date
    Sep 2004
    Posts
    103

    How?

    But how would I set this the way you have when I already have a method

    "public calendarmain () {
    myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    myFrame.setSize(675,600);

    JDesktopPane myDesktop = new JDesktopPane();
    myFrame.setContentPane(myDesktop);

    JInternalFrame calendar1 = createFrame1("Calendar Main");"

    // and then all the Internal Frames are within the method calendarmain


    //Would I go outside Calendarmain Scrapping the current one
    // using your method?

    JInternalFrame calendar1 = calendarmain.getJinternalFrame();;

    // I've tried this in the method calendarmain and it doesn't work?
    // Maybe I dont' understand what your telling me, obviously?

  6. #6
    Join Date
    Sep 2004
    Posts
    103

    Seeking Sjalles Wisom

    Okay I've got everything working except there are major errors with my scroll pane. everytime I implement table.setvisible to true on line 258 it doesn' t work gives me a lot of errors I dont' quite understand, ANy Input?
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center