Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!novia!news-xxxfer.readnews.com!textspool1.readnews.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "tar" Subject: Re: Window close & non-re Message-ID: X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui In-Reply-To: References: Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 41 Date: Wed, 27 Apr 2011 15:47:53 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303919273 96.60.20.240 (Wed, 27 Apr 2011 10:47:53 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:47:53 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:3956 To: comp.lang.java.gui On Wed, 06 Aug 2008 15:20:45 +0100, Rexx Magnus wrote: > Right, managed to sort this out: > this.getFrame().setResizable(false); > this.getFrame().setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); > this.getFrame().addWindowListener(new Closer()); > > > In just after the initComponents(); line and added my Closer() routine > elsewhere. One problem remains now though, when you close the window > via the close button, this works - except if you're on a Mac and exit > via the Quit menu (system menu, not one in the frame) it bypasses the > routine. To handle those events, I think you will need to use some Mac-specific coding. Apple has some examples which show how to handle that in a way that works (and compiles) even on non-Mac systems that don't use the Mac specific application adapters. It relies on using the reflection mechanism to find the Mac-specific code. Look at the OSXAdapter sample code: And for some more Mac-related background: -- Thomas A. Russ, USC/Information Sciences Institute --- * 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