JDK-4751776 : javax.swing.Action shoud support displayedMnemonicIndex
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1,1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-09-23
  • Updated: 2005-08-26
  • Resolved: 2005-08-26
Related Reports
Duplicate :  
Description
Name: gm110360			Date: 09/23/2002


FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)


FULL OPERATING SYSTEM VERSION :
This is an RFE for an API change, but since you ask...
Microsoft Windows 2000 [Version 5.00.2195]


A DESCRIPTION OF THE PROBLEM :
When the displayedMnemonicIndex was added
to AbstractButton, no provision was made
for configuring it with Actions.

Here's a comment I wrote for bug 4138746:

  If AbstractButton is going to have this this
  new 'displayedMnemonicIndex' property, then
  it should be supported by the Action interface.

  For example:

    Action a = new AbstractAction() {
          putValue(NAME, "Save As...");
          putValue(SMALL_ICON, new ImageIcon(icons/saveas.gif));
          putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_A));
          putValue(DISPLAYED_MNEMONIC_INDEX, new
Integer(5)); // <----- need to be able to do this
          putValue(SHORT_DESCRIPTION, "Save to a new file
name");
          // could also set values for ACTION_COMMAND_KEY
and ACCELERATOR_KEY
          setEnabled(true);
        };
    JButton saveAsButton = new JButton(a);
    JMenuItem saveAsMenuItem = new JMenuItem(a);


Of course the real work in implementing this will
be in AbstractButton and its subclasses. Action
only needs only a new key for the property.


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER WORKAROUND :
Work arounds are tough unless you're
willing to create one's buttons/menus
without using Actions.
(Review ID: 164827) 
======================================================================

Comments
EVALUATION This will be fixed as part of 4133141, closing as a duplicate.
26-08-2005