This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 126440 - DialogDisplayer.createDialog should return JDialog
Summary: DialogDisplayer.createDialog should return JDialog
Status: RESOLVED INCOMPLETE
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-31 19:24 UTC by longstrb
Modified: 2012-06-26 11:00 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description longstrb 2008-01-31 19:24:01 UTC
The DialogDisplayer.createDialog currently returns the AWT Dialog type.  However, I have been told that it should 
always return JDialog type implicitily as long as the default dialog services are used.  Because JDialog type has 
valuable features for controlling the dialog like disabling the close button, etc..., and AWT is not really used, I 
propose that all DialogDisplay.create functions return the JDialog as the base type instead of Dialog.

The following code snippet is from the Netbeans sources itself and shows a common example of wanting to use the 
JDialog interface for disabling the windows close button.

        dialog = DialogDisplayer.getDefault().createDialog(dd);
        if (dialog instanceof JDialog) {
            ((JDialog)dialog).setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        }

A good example of this would be creating a cancellable dialog where the action to close the dialog is based on logic 
and state, not just user clicking the close or cancel button.  In order to establish this functionality, one must 
listen for button and window messages.  However, if you dont disable the default close operation, it won't 
work...Hence the reason for the code snippet above.
Comment 1 snookiex 2010-08-18 14:07:19 UTC
NotifyDisplayer has a similar problem because just closing the window you can ignore the message. I think this should be at least documented at the official javadoc.
Comment 2 Stanislav Aubrecht 2012-06-26 11:00:18 UTC
DO_NOTHING_ON_CLOSE should be taken care of in #196200

Any other use cases for JDialog return value?