🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #3587

Re: Getting a dialog window to close properly

#3587
From: Marc Rochkind
Date: Wed, 12 Nov 1997 00:00
66 lines
2443 bytes
Thanks for this posting, Bryce. I had the same question, and found your
message right away!

Bryce H. Hooker wrote in message <62qk0d$tg4@forums.borland.com>...
>Since posting the same question several weeks ago, and never receiving a
>reply, I found the answer in the excellent book, "The Java Faq" by Jonni
>Kanerva.  In fact, this was one of the criteria I used for buying the book.
>Here is the code from the book:
>
>class WindowCloser extends WindowAdapter
>{
>  public void windowClosing(WindowEvent e)
>  {
>    e.getWindow().dispose();
>  }
>}
>
>I used the following code in the standard help dialog created by the
>JBuilder wizard:
>
>this.addWindowListener(new WindowCloser());
>
>It works perfectly.  I think it is quite an oversight that the wizard does
>not generate this code for you.  It is pretty sloppy to generate a window
>with a non functional close button.
>
>Enjoy,
>Bryce
><62oa0o$ag12@forums.borland.com>...
>>The following code works (as in the textEdit tutorial) to let a user close
>>the Java application's main window from the window close pulldown
>(CTRL+F4),
>>or the close window pushbutton (i.e. the X in win95):
>>
>>/**
>>   * Override system close handler
>>   */
>>  protected void processWindowEvent(WindowEvent e) {
>>    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
>>        System.exit(0);
>>    }
>>  }
>>
>>I tried to use similar code so a user can use the same window controls to
>>close a dialog box:
>>
>>/**
>>   * Override system close handler
>>   */
>>  protected void processContainerEvent(ContainerEvent e) {
>>    if (e.getID() == ContainerEvent.?????????) {
>>        myDialog.setVisible(false);
>>     }
>>  }
>>
>>First, does anyone know the correct event name I need to check for?
>>Also, how can you see what events are being triggered in the JBuilder
>>debugger?
>>
>>Thanks in advance,
>>SG
>>
>>
>
>
Technical Details
Message-ID: <64cj11$ro39@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <62oa0o$ag12@forums.borland.com> <62qk0d$tg4@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,bfcb89890bc09b6
X-Google-Attributes: gid1089d0,public
From: "Marc Rochkind" <rochkind@ix.netcom.com>
Subject: Re: Getting a dialog window to close properly
Date: 1997/11/12
Message-ID: <64cj11$ro39@forums.borland.com>
X-Deja-AN: 288961150
References: <62oa0o$ag12@forums.borland.com> <62qk0d$tg4@forums.borland.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Organization: None
Newsgroups: borland.public.jbuilder.java.api