Results 1 to 3 of 3

Thread: JInternalFrames

  1. #1

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Exclamation JInternalFrames

    Right now, I am using NetBeans 5.5 and I am confused about the internal frames. I have a main frame that has a JDesktopPane inside of it. Inside this JDesktopPane I have one JInternalFrame. This JInternalFrame is supposed to be used for order entry so once the user clicks the Submit Order button, the screen should clear and dispose. When the user wants to enter a new order it should instantiate a new internal frame so the old data is cleared out of the box and a fresh form is available to the user. How can I do this so that when the user wants to enter a new order, a new instance of the internal frame is available to the user instead of just setting the internal frame from visible = false to visible = true where the data is still there? Do I just have to clear all of the fields when the user hits the submit button and set the form visibility to false once they submit the order?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: JInternalFrames

    That's one way. Another way is to dispose() the old internal frame and actually create a new instance when a new one is needed.

    Clearing out is faster. Disposing and recreating is easier to implement and easier to maintain. For example, if you dispose and recreate, all fields will be cleared. If you manually clear all fields, and later add a new field, you'll have to remember to clear that, too.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Re: JInternalFrames

    Well, I dragged and dropped the JInternalFrame into the JDesktopPane but the JInternalFrame (called AccountUpdate) isnt a class, it looks like NetBeans makes it an object of the MainFrame.java class that I have which has the JDesktopFrame dropped on the main JFrame (MainFrame.java class). It looks like it makes it an object of the JDesktopFrame... so how would I create a new instance of that object if it is part of another object? Since its an object of that JDesktopFrame and I can't instantiate it (as i know of) the dispose method isnt in the list of available methods for that object. I just have the setVisible method.

    The reason I am saying this is because on the left where it has the Method Navigator and the Inspector... in the Inspector tab it has a list of all of the object associated with that JFrame. Under the JDesktopPane in this list is the JInternalFrame (AccountUpdate).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width