Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

JDialog window event when closed by the parent

Thread view: 
stanberka - 03 Aug 2006 17:04 GMT
Hi,

We have an application that has a main JFrame and a JDialog child.  I'd
like to capture every possibility of closing the child window by user.
However, I'm not getting the windowClosing event on the child when the
parent is closed (which closes the whole app and the child).  Is there
any way to listen to an event like this?
Andrew Thompson - 03 Aug 2006 17:21 GMT
..
> We have an application that has a main JFrame and a JDialog child.  I'd
> like to capture every possibility of closing the child window by user.
> However, I'm not getting the windowClosing event on the child when the
> parent is closed (which closes the whole app and the child).  Is there
> any way to listen to an event like this?

Why not simply make the JDialog modal?

It would make the rest of the question 'moot'.

Andrew T.
dsjoblom@abo.fi - 03 Aug 2006 21:15 GMT
> ..
> > We have an application that has a main JFrame and a JDialog child.  I'd
[quoted text clipped - 6 lines]
>
> It would make the rest of the question 'moot'.

Because modal dialogs are sometimes annoying. Take for instance a basic
'Find' dialog that you'll find in many editors. Why should it not be
possible to edit text while displaying the dialog?

To the OP: try listening to the windowClosed event also.

Regards,
Daniel Sjöblom
Andrew Thompson - 04 Aug 2006 03:18 GMT
> > ..
> > > We have an application that has a main JFrame and a JDialog child.  I'd
[quoted text clipped - 10 lines]
> 'Find' dialog that you'll find in many editors. Why should it not be
> possible to edit text while displaying the dialog?

I never said it shouldn't.  But let me put the question back
to you in slightly altered form.
 'Why should a 'Find' dialog, block program exit?'

(And for 'Find', insert any good example of a use for a
non-modal dialog)

If a dialog is not important enough to block access to
the main GUI, it seems it is also not important enough
to interfere with the application's standard exit behaviour.

'The path of least surprise' is not being followed here.

Andrew T.
dsjoblom@abo.fi - 04 Aug 2006 10:28 GMT
> > > Why not simply make the JDialog modal?
> > >
[quoted text clipped - 16 lines]
>
> 'The path of least surprise' is not being followed here.

Ah. I see what you mean. Certainly something to consider, and after
thinking about it, I agree with you in the general case, although I
guess there could be exceptions to this design rule. Thanks for the
clarification.

Regards,
Daniel Sjöblom


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.