Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #434

closing a specific JFrame

From "William Z." <william.z.@THRWHITE.remove-dii-this>
Subject closing a specific JFrame
Message-ID <1166480819.702914.157250@n67g2000cwd.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
Date 2011-04-27 15:27 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
I have a JFrame that, when I click "new" in the menu bar, creates
another JFrame like that of the first. It just runs the following code
...

EventQueue.invokeLater(new Runnable() {
   public void run() {
      MyApp app = new MyApp();
      app.createGUI();
   }
});

And inside the createGUI() method is this ...

addWindowListener(new WindowListener() {
   public void windowOpened(WindowEvent arg0) {}
   public void windowClosed(WindowEvent arg0) {}
   public void windowIconified(WindowEvent arg0) {}
   public void windowDeiconified(WindowEvent arg0) {}
   public void windowActivated(WindowEvent arg0) {}
   public void windowDeactivated(WindowEvent arg0) {}
   public void windowClosing(WindowEvent arg0) {
      System.exit(0);
   }
});

As it works right now, when I close a window, all the windows close and
I'd just like to close only that specific window in which the user
clicked the close button.

Any help much appreciated.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar


Thread

closing a specific JFrame "William Z." <william.z.@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: closing a specific JF "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
    Re: closing a specific JF "William Z." <william.z.@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: closing a specific JF "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000

csiph-web