🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Cancel WINDOW_CLOSING

#7473
From: Martin Andersson
Date: Tue, 23 Jan 2001 17:47
47 lines
1996 bytes
Try to change the order of the calls, ie:

protected void processWindowEvent(WindowEvent e) {
   if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      if(!cancelClosing) {
         super.processWindowEvent(e);
         System.exit(0);
      }
   }
}

/Martin

"Hartmut" <hartmut.kiessling@bnhof.de> wrote in message
news:3a6da021_1@dnews...
> To be more exact:
>
> I tried to insert my method
> boolean cancelClosing()
> into the JBuilder generated code like
>
>  public void jMenuFileExit_actionPerformed(ActionEvent e)
>  {
>     if( ! cancelClosing() )
>       System.exit(0);
>  }
>
> The WINDOW.CLOSING event calls this also:
>
>  protected void processWindowEvent(WindowEvent e)
>  {
>   super.processWindowEvent(e);
>   if (e.getID() == WindowEvent.WINDOW_CLOSING)
>   {
>    jMenuFileExit_actionPerformed(null);
>   }
>  }
>
>
> Now, if the user clicks jMenuFileExit, it works like I want: if
> cancelClosing() returns false, the closing is canceled.
> But if he clicks the frame's close button (WINDOW_CLOSING),
cancelClosing()
> is called, but can't cancel the closing.
>
>
>
Technical Details
Message-ID: <94kfvl$t1c1@bornews.inprise.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.icl.net!news.algonet.se!algonet!newsfeed1.uni2.dk!newssuck.uni2.dk!bornews.borland.com!not-for-mail
References: <3a6d9d3c_2@dnews> <3a6da021_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,843135985a332749
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2001-01-23 09:52:43 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.icl.net!news.algonet.se!algonet!newsfeed1.uni2.dk!newssuck.uni2.dk!bornews.borland.com!not-for-mail
From: "Martin Andersson" <b97maran@student.his.se>
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: Cancel WINDOW_CLOSING
Date: Tue, 23 Jan 2001 18:47:44 +0100
Organization: Another Netscape Collabra Server User
Lines: 49
Message-ID: <94kfvl$t1c1@bornews.inprise.com>
References: <3a6d9d3c_2@dnews> <3a6da021_1@dnews>
NNTP-Posting-Host: 193.10.185.3
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200