Article View: borland.public.jbuilder.java.swing
Article #670Re: how to stop exiting, or how are frame decorations disabled?
From: J. User
Date: Tue, 11 Jan 2005 21:27
Date: Tue, 11 Jan 2005 21:27
23 lines
1972 bytes
1972 bytes
In article <413c27ba$1@newsgroups.borland.com>, ng-b@JPMcGrath.net says...
> On 9/5/2004 at 10:25:23 PM, andy dingfelder wrote:
>
> > How can I trap the exit icon (the upper right X) actions so that I can
> > do some logic first and under some conditions display a message instead
> > of exiting?
>
> Disable the automatic closing of the JFrame using
>
> frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
>
> Then add a WindowListener to the JFrame:
>
> frame.addWindowListener( new WindowAdapter() {
> public void windowClosing( WindowEvent event ) {
> // Decide whether to dispose the frame, exit, etc.
> }
> };
That is how I handle the problem but users then complain if the window close decoration is enabled and does
nothing. I can make it equivalent to calling the existing exit function from the file menu but what I'd really
like to do is disable (just) the exit frame decoration... as far as I can see there is no way to do this. Am I
just not finding it in the docs or is it really not possible from java?
Technical Details
Message-ID:
<MPG.1c4de4b6f5154587989687@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<413bca93$1@newsgroups.borland.com> <413c27ba$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,76f888c29044beef X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit From: J. User <nospam@here.please.org> Newsgroups: borland.public.jbuilder.java.swing Subject: Re: how to stop exiting, or how are frame decorations disabled? Date: Tue, 11 Jan 2005 13:27:55 -0800 Message-ID: <MPG.1c4de4b6f5154587989687@newsgroups.borland.com> References: <413bca93$1@newsgroups.borland.com> <413c27ba$1@newsgroups.borland.com> Distribution: world Organization: not really X-Newsreader: MicroPlanet Gravity v2.50 NNTP-Posting-Host: 24.85.71.63 X-Trace: newsgroups.borland.com 1105478508 24.85.71.63 (11 Jan 2005 13:21:48 -0800) Lines: 23 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail