Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #3912
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail |
|---|---|
| From | "Rexx Magnus" <rexx.magnus@THRWHITE.remove-dii-this> |
| Subject | Re: Window close & non-re |
| Message-ID | <op.ufg4gi2mp9vcmo@macmini.local> (permalink) |
| X-Comment-To | comp.lang.java.gui |
| Newsgroups | comp.lang.java.gui |
| In-Reply-To | <op.ufgx4vvtp9vcmo@macmini.local> |
| References | <op.ufgx4vvtp9vcmo@macmini.local> |
| Content-Type | text/plain; charset=IBM437 |
| Content-Transfer-Encoding | 8bit |
| X-Gateway | time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] |
| Lines | 59 |
| Date | Wed, 27 Apr 2011 15:47:39 GMT |
| NNTP-Posting-Host | 96.60.20.240 |
| X-Complaints-To | news@tds.net |
| X-Trace | newsreading01.news.tds.net 1303919259 96.60.20.240 (Wed, 27 Apr 2011 10:47:39 CDT) |
| NNTP-Posting-Date | Wed, 27 Apr 2011 10:47:39 CDT |
| Organization | TDS.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.gui:3912 |
Show key headers only | View raw
To: comp.lang.java.gui
On Wed, 06 Aug 2008 15:20:45 +0100, Rexx Magnus <trashcan@uk2.net> 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.
I've tried adding:
app.addExitListener(new myExit());
Just after it, to see if I can get an ExitListener to catch it, using the
following based on an example in the javadocs:
class myExit implements Application.ExitListener {
public boolean canExit(EventObject e) {
Object source = (e != null) ? e.getSource() : null;
System.out.println("Canexit");
Component owner = (source instanceof Component) ?
(Component)source : null;
int option = JOptionPane.showConfirmDialog(owner, "Really Exit?");
return option == JOptionPane.YES_OPTION;
}
public void willExit(EventObject e) {
System.out.println("Willexit");
}
}
However, it's not working as far as I can tell. I did try putting it into
the other class directly as an override to the shutdown() method of the
application, but couldn't get that to work either.
---
* 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 | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Window close & non-resiza "Rexx Magnus" <rexx.magnus@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
Re: Window close & non-re "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
Re: Window close & non-re "Rexx Magnus" <rexx.magnus@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
Re: Window close & non-re "Rexx Magnus" <rexx.magnus@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
Re: Window close & non-re "Rexx Magnus" <rexx.magnus@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
Re: Window close & non-re "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
Re: Window close & non-re "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
csiph-web