Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4751776

javax.swing.Action shoud support displayedMnemonicIndex

    XMLWordPrintable

Details

    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)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              svioletsunw Scott Violet (Inactive)
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: