Article View: borland.public.jbuilder.java.swing
Article #672Re: how to stop exiting, or how are frame decorations disabled?
From: J. User
Date: Wed, 12 Jan 2005 21:38
Date: Wed, 12 Jan 2005 21:38
33 lines
2531 bytes
2531 bytes
In article <xn0dx52tjd1ywzu00r@newsgroups.borland.com>, ng-b@JPMcGrath.net says...
> On 1/11/2005 at 4:27:55 PM, J. User wrote:
>
> > > 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 think the "normal" implementation of the "// Decide whether ..." part
> would be to check the appropriate conditions (e.g. document changed) and
Yes, I believe I went on to describe something like that.
> ask the user if he really wants to exit. Even if you do not want to give
> the user a choice, it still would seem appropriate to display a message
> dialog telling the user why you are refusing to exit. So pressing the
> close button would not "do nothing".
Perhaps I should have said "accomplishes nothing useful"
> > 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.
>
> AFAIK, there is no standard Java way to disable the close button. You can
Too bad... seems like something that ought to be there. Oh well... at least
now I know not to waste more time looking for it - thank you!
Technical Details
Message-ID:
<MPG.1c4f38c5205e35e989688@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news3.google.com!news.glorb.com!dedekind.zen.co.uk!zen.net.uk!demorgan.zen.co.uk!194.72.9.35.MISMATCH!news-peer1!btnet-feed3!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<413bca93$1@newsgroups.borland.com> <413c27ba$1@newsgroups.borland.com> <MPG.1c4de4b6f5154587989687@newsgroups.borland.com> <xn0dx52tjd1ywzu00r@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: Wed, 12 Jan 2005 13:38:51 -0800 Message-ID: <MPG.1c4f38c5205e35e989688@newsgroups.borland.com> References: <413bca93$1@newsgroups.borland.com> <413c27ba$1@newsgroups.borland.com> <MPG.1c4de4b6f5154587989687@newsgroups.borland.com> <xn0dx52tjd1ywzu00r@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 1105565561 24.85.71.63 (12 Jan 2005 13:32:41 -0800) Lines: 34 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news3.google.com!news.glorb.com!dedekind.zen.co.uk!zen.net.uk!demorgan.zen.co.uk!194.72.9.35.MISMATCH!news-peer1!btnet-feed3!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail