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.
I have created a Dialog using method DialogDisplayer.createDialog(DialogDescriptor) The DialogDescriptor I provided contained an array of JButtons as options and one of the buttons in place of 'initialValue'. When the dialog is displayed, the button passed as the 'initialValue' is not displayed as the default button of the dialog.
I looked into the source code of class org.netbeans.core.windows.NbPresenter whose instance is (I guess) created by the above mentioned method 'createDialog(...)'. The key part of the code is method 'initializeButtons()', specifically its part below comment "// explicitly provided options (AKA buttons)". What I read in the code is that: - options passed as instances of (i.e. implementing interface) Icon cannot be used as default options (although they are displayed as buttons in the resulting dialog) - for options passed as instances of JButton, DialogDescriptor's property 'initialValue' is ignored and the first button is used as the default button (unless setDefaultCapable(false) had been called on it before the dialog was created) Property 'initialValue' is thus used only for standard options or for options which are passed as objects which neither implement javax.swing.Icon nor are instances of JButton. Is there any reason for such rules?
reassigned to core/window system
It would be good if it was possible to specify that no button is to be default (e.g. by specifying <null> in place of DialogDescriptor constructor's parameter 'initialValue').
I didn't implement it. Have seen that code before, but don't understand those rules, assigning to dialogs
fixed in core/windows/src/org/netbeans/core/windows/services/NbPresenter.java, rev 1.4. Bugfix should respect DialogDescriptor's initial value.
Reopening - the fix is wrong. I think that a "return" statement is missing after the "getRootPane ().setDefaultButton (b)" statement you added.
Thanks for your notice. The return clause was really missed. It's changed new.
Verified in a custom build from 18 November 2003 (sources updated around 10 minutes after Jiri Rechtacek's last message).