Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4137095
Votes 5
Synopsis Keyboard mnemonics for buttons provided by JOptionPane
Category java:classes_swing
Reported Against 1.2.2 , swing1.0.2
Release Fixed 1.4(merlin-beta2)
State 10-Fix Delivered, request for enhancement
Priority: 4-Low
Related Bugs 4515027
Submit Date 11-MAY-1998
Description




The buttons in the dialogs provided by JOptionPane
do no have keyboard mnemonics. Moreover, there
isn't a way to get the references to those
buttons. Therefore there is no way to provide
keyboard mnemonics for the buttons in JOptionPane.
(Review ID: 30051)
======================================================================




I would like to have keyboard mnemonics for JOptionPane, so you
could press 'Y' to indicate Yes and 'N' to indicate No.
(Review ID: 93480)
======================================================================
Work Around
N/A
Evaluation
Yes, we should support mnemonics in the buttons in JOptionPane as defined
by the various look&feels.  Windows definitely supports mnemonics; need to
investigate Motif and Metal.

  xxxxx@xxxxx   2000-03-15

There is now the option to provide mnemonics. We currently only define them for yes/no, but you can define them for all the buttons we provide. The properties added are:
OptionPane.yesButtonMnemonic
OptionPane.noButtonMnemonic
OptionPane.okButtonMnemonic
OptionPane.cancelButtonMnemonic

  xxxxx@xxxxx   2001-06-27

These properties exist in com/sun/swing/internal/plaf/basic/resources/basic.properties. You can override them by setting these values directly in the UIDefaults (UIManager.put("xxx", "newValue");
  xxxxx@xxxxx   2002-01-22
Comments
  
  Include a link with my name & email   

Submitted On 21-JAN-2002
arunlekha
I will like to know as where are these properties 
yesButtonMnemonic, noButtonMnemonic etc defined. I do not 
see them in JOptionPane class


Submitted On 07-MAY-2002
kgupta11
This does not seem to work. I am doing the following:
UIManager.put("OptionPane.okButtonMnemonic","O");


Submitted On 10-MAY-2002
sky_1071
UIManager.put("OptionPane.okButtonMnemonic", "0");
is equivalent to NO mnemonic. The value should consider to
a VK constant, for example:
UIManager.put("OptionPane.okButtonMnemonic", "79"),
which corresponds to VK_O. The mnemonic must also exist in
the string, otherwise you won't see the character.


Submitted On 08-JUN-2006
vob
The mnemonic configuration does not work in case that options are specified as String array. The following code displays a question pane with "No" as default, but BasicOptionPaneUI will never evaluate the mnemonics for the buttons it creates for the given options.

    String[] options = new String[] { "Yes", "No" };
    JOptionPane.showOptionDialog(null,
        "A message",
        "Title",
        JOptionPane.YES_NO_OPTION,
        JOptionPane.QUESTION_MESSAGE,
        null,
        options,
        options[1]);


Submitted On 20-SEP-2006
if JOptionPane just shows a Confirm/Error/Warnung/Information-Message it should be possible to press the mnemonics without having to press the ALT-Key. 
For example if I show a YES_NO_OPTION it should be possible just to press Y or N instead of ALT+Y, ALT+N.



PLEASE NOTE: JDK6 is formerly known as Project Mustang