🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #11525

JInternalFrame prevent from Closing

#11525
From: Michael Härtig
Date: Tue, 18 May 1999 00:00
40 lines
1860 bytes
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: <37414795.ABE6F2A3@nupis.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,4fdaf2d63db86e3c
X-Google-Attributes: gid111d45,public
From: Michael Härtig <haertig@nupis.de>
Subject: JInternalFrame prevent from Closing
Date: 1999/05/18
Message-ID: <37414795.ABE6F2A3@nupis.de>
X-Deja-AN: 479382170
Content-Transfer-Encoding: 8bit
Organization: Another Netscape Collabra Server User
X-Accept-Language: de
Content-Type: text/plain; charset=iso-8859-1
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing