Results 1 to 5 of 5
  1. #1
    longphant is offline Member
    Join Date
    Aug 2010
    Posts
    1
    Rep Power
    0

    Default Closing 1 Desktop App, But Not The Other

    My main class, call it Main.java, calls a Desktop Application I created in Netbeans. After the user clicks a button, it returns to Main.java, which then calls another desktop application which I created with Netbeans. The thing is, if I close one of them, I end up closing both. Is there a way that I can just close one but not the other?

    These GUIs (GUI1 and GUI2) are called by: I changed the main method in GUI1App.java and GUI2App.java to be called "launch" instead of main. Then in my Main.java, I just use

    String[] args = {};
    GUI1App app = new GUI1App();
    app.launch(args};

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    if I close one of them, I end up closing both. Is there a way that I can just close one but not the other
    What method do you call to 'close' a "Desktop app"?
    Are the "app"s JFrame windows? Can you call setVisible(false) to hid a window?

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

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

    Default

    Don't have multiple JFrames. Instead have your main app be a JFrame and the dialog window a JDialog (the tutorials will show you how), or even better, swap views with a CardLayout. Also you will benefit greatly by not using NetBeans to generate your Swing code, but rather to learn to code it yourself through the Sun / Oracle tutorials.

    Luck.

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

    Default

    Quote Originally Posted by Darryl.Burke View Post
    Darryl, thanks for the heads up.

    Original poster, please do not cross-post without notifying us as this behavior can make us duplicate effort that has been done elsewhere. If you've ever volunteered at a technical forum, you'll understand the frustration this causes.

Similar Threads

  1. closing FileOutputStream?
    By mgrootsch in forum New To Java
    Replies: 1
    Last Post: 05-17-2010, 05:36 PM
  2. Closing a JFrame
    By SBL in forum AWT / Swing
    Replies: 5
    Last Post: 11-23-2009, 02:54 PM
  3. Desktop app on an off-focus desktop
    By thommy_lobo in forum Advanced Java
    Replies: 0
    Last Post: 11-09-2009, 06:56 AM
  4. Closing an Editor
    By janpol1 in forum Eclipse
    Replies: 0
    Last Post: 02-14-2009, 04:00 PM
  5. Closing packages
    By uncopywritable in forum New To Java
    Replies: 0
    Last Post: 08-13-2007, 11:47 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
  •