Article View: borland.public.jbuilder.java.swing
Article #11526Re: JInternalFrame prevent from Closing
From: kerbel
Date: Tue, 18 May 1999 00:00
Date: Tue, 18 May 1999 00:00
56 lines
2492 bytes
2492 bytes
You need to implement the VetoableChangeListener interface. You then
code a custom vetoableChange method which can ask the user if they are
sure they want to exit, etc. In this method the closing/remaining open
is taken care of. You can then add a vetoableChangeListener to each
internal frame and the method will take care of the rest for you.
Uri Kerbel
--
uri@kalbi.demon.co.uk
www.kalbi.demon.co.uk
On Tue, 18 May 1999 12:57:25 +0200, Michael =?iso-8859-1?Q?H=E4rtig?=
<haertig@nupis.de> wrote:
>Hi all
>
>I have a problem with my JInternalFrame. If the user select Close from
>System-Menu (X) I want to ask if he is sure or not. I added a
>InternalFrameListener and set the DefaultCloseOperation. But how can I
>say NO, don't close???? The Frame always closes.
>
>Here my code..
>
>public MyInternalFrame(){
> ...
> this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
> this.addInternalFrameListener(new InternalFrameAdapter(){
> public void internalFrameClosing(InternalFrameEvent ev){
> //Here is a call of a Dialog that returns true (Yes, close) or
>false (No, not close)
> if (new MessageDialog()) this.setVisible(false);
> else return; //Doesnt work
> }
> });
> ...
>}
>
>Hoping for help
>
>Michael
>--
> ////
> (o o)
>+-----ooO--(_)--Ooo---------------------------------------+
>| |
>| Michael H�rtig Neumann & Partner |
>| Informationssysteme GmbH |
>| Softwareentwicklung An der Hohen Stra�e 1 |
>| 08393 Meerane |
>| |
>+------------Oooo-----------------------------------------+
> oooO ( )
> ( ) (_)
> (_)
--
Technical Details
Message-ID:
<374159d9.660815@news.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37414795.ABE6F2A3@nupis.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,4fdaf2d63db86e3c X-Google-Attributes: gid111d45,public From: kerbel@kalbi.demon.co.uk Subject: Re: JInternalFrame prevent from Closing Date: 1999/05/18 Message-ID: <374159d9.660815@news.demon.co.uk> X-Deja-AN: 479411843 X-NNTP-Posting-Host: kalbi.demon.co.uk:158.152.128.133 References: <37414795.ABE6F2A3@nupis.de> X-Trace: news.demon.co.uk 927030191 nnrp-01:22832 NO-IDENT kalbi.demon.co.uk:158.152.128.133 Reply-To: kerbel@kalbi.demon.co.uk Newsgroups: borland.public.jbuilder.java.swing X-Complaints-To: abuse@demon.net