Results 1 to 4 of 4
  1. #1
    stoxic is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default Showing each window

    Hello.

    I am working with netbeans, making a desktop application. I created several JFrames (each on a seperate java file) and I want, when I press a button to close the window that is active and show the new one.

    How is this possible?

    Thanks in advance.

  2. #2
    stoxic is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default

    so? any suggestions?

    Thanks for reading.

  3. #3
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by stoxic View Post
    Hello.

    I am working with netbeans, making a desktop application. I created several JFrames (each on a seperate java file) and I want, when I press a button to close the window that is active and show the new one.

    How is this possible?

    Thanks in advance.

    on the active window call the method dispose() and then to show the new one use new ClassFrameName(); assuming that all frames are in the same package.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    My advice is not to do this. For one you shouldn't gear your GUI creation to creating JFrames but rather JPanels. Then you can create one single JFrame and swap these JPanels with a CardLayout as desired.

Similar Threads

  1. Replies: 4
    Last Post: 01-10-2010, 07:48 AM
  2. Java and WebServices: showing a Loading window
    By BeRniTo in forum Advanced Java
    Replies: 0
    Last Post: 11-06-2009, 04:33 AM
  3. change url in parent window from child window
    By rakesh_n_mehta in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-09-2009, 12:17 PM
  4. how can i move one frame window to another window
    By santhosh_el in forum AWT / Swing
    Replies: 8
    Last Post: 06-10-2009, 03:36 PM
  5. Replies: 1
    Last Post: 02-20-2009, 03:49 PM

Posting Permissions

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