NotifyDescriptor's initialValue and mnemonics

View: New views
3 Messages — Rating Filter:   Alert me  

NotifyDescriptor's initialValue and mnemonics

by shansi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a dialog with Yes/No Option type and I use a NotifyDescriptor.

But the problem is that I should always have the No Option selected by default.

NotifyDescriptor nd = new NotifyDescriptor(msg, title, NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE,null,NotifyDescriptor.NO_OPTION);
DialogDisplayer.getDefault().notify(nd);

But this doesnt work.Always the Yes option is selected.

Is there anyother way I could acheive the same?Also is it possible to set the mnemonics for the Yes and No buttons?

Thanks.

Re: NotifyDescriptor's initialValue and mnemonics

by Jesse Glick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

shansi wrote:
> NotifyDescriptor nd = new NotifyDescriptor(msg, title,
> NotifyDescriptor.YES_NO_OPTION,
> NotifyDescriptor.QUESTION_MESSAGE,null,NotifyDescriptor.NO_OPTION);
> DialogDisplayer.getDefault().notify(nd);
>
> This doesn't work. Always the Yes option is selected.

http://wiki.netbeans.org/DevFaqFileBug

> Is it possible to set the mnemonics for the Yes and No buttons?

You would need to make your own JButton's in such a case. Anyway you
would not want a mnemonic for the No button if it were the default
button for the dialog (the default button of a dialog should
conventionally have no mnemonic since just Enter works). In the normal
yes/no dialog, No (i.e. the non-default button) doesn't have a mnemonic
either because Escape (or closing the dialog window) has the same function.


Re: NotifyDescriptor's initialValue and mnemonics

by John Baker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



> Is it possible to set the mnemonics for the Yes and No buttons?

You would need to make your own JButton's in such a case. Anyway you
would not want a mnemonic for the No button if it were the default
button for the dialog (the default button of a dialog should
conventionally have no mnemonic since just Enter works). In the normal
yes/no dialog, No (i.e. the non-default button) doesn't have a mnemonic
either because Escape (or closing the dialog window) has the same function.




The A11Y NetBeans plugin reports that a dialog created via NotifyDescriptor..Confirmation(..)  is missing a mnemonic for the No button.  Does this mean the A11Y tool is mistaken or
NotifyDescriptor.Confirmation(..) API should provide mnemonics?

Thanks
John