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

Mnemonic disappears after repeated attempts to open menu items using mnemonics

    Details

    • Subcomponent:
    • Resolved In Build:
      b61
    • CPU:
      x86
    • OS:
      windows_xp

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.6.0_15"
        Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
        Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows XP [Version 5.1.2600]

        A DESCRIPTION OF THE PROBLEM :
        Mnemonic disappears after repeated attempts to open menu items using mnemonic key:

        Problem:
        When you press a sequence of hot keys/ mnemonics, Panels stop displaying the Mnemonics for the menu items.

        Sample scenario, press Alt+F, Alt+S (No action in between like mouse click or esc) the Mnemonics letters doesn't get displayed. (chose 'F' & 'S' as sample code below use same mnemonics.

        Problem is reproducible only with "SystemLAF", but if we use "Metal/Motif LAF" then we do not have this problem as the menus appear differently.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Sample scenario, press Alt+F, Alt+S (No action in between like mouse click or esc) the Mnemonics letters doesn't get displayed. (chose 'F' & 'S' as sample code below use same )won't get displayed, after the very first time for which mnemonics get displayed.




        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Expected Results:
        No matter how many ever times the mnemonics/hot keys are tried to access by pressing Alt+F or Alt+(any mnemonic present in menu item),particular mnemonic should get displayed/underlined properly.

        ACTUAL -
        Actual Result:
        Alt+(any mnemonic present in menu item). it should get displayed/underlined every time the operation is performed.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        No error messages logged.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------

        import java.awt.event.ActionEvent;
        import java.awt.event.ActionListener;
        import java.awt.event.KeyEvent;

        import javax.swing.JFrame;
        import javax.swing.JMenu;
        import javax.swing.JMenuBar;
        import javax.swing.JMenuItem;
        import javax.swing.UIManager;
        import javax.swing.UnsupportedLookAndFeelException;



        class MenuActionListener implements ActionListener {
          public void actionPerformed(ActionEvent actionEvent) {
            System.out.println("Selected: " + actionEvent.getActionCommand());
          }
        }

        public class MenuLookDemo {

          public static void main(final String args[]) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
            ActionListener menuListener = new MenuActionListener();
            JFrame frame = new JFrame("Menu Look Demo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            
            JMenuBar menuBar = new JMenuBar();
            
            // used to set to Windows LAF
            String systemLAF;
            systemLAF = UIManager.getSystemLookAndFeelClassName();
            UIManager.setLookAndFeel(systemLAF);
            

            // First Menu, F - Mnemonic
            JMenu firstMenu = new JMenu("Fisrt Menu");
            firstMenu.setMnemonic(KeyEvent.VK_F);
            menuBar.add(firstMenu);
           

            // Fisrt Menu - menu items
            JMenuItem oneMenuItem = new JMenuItem("One", KeyEvent.VK_O);
            oneMenuItem.addActionListener(menuListener);
            firstMenu.add(oneMenuItem);

            JMenuItem twoMenuItem = new JMenuItem("Two", KeyEvent.VK_T);
            twoMenuItem.addActionListener(menuListener);
            firstMenu.add(twoMenuItem);
            
            // Second Menu, S - Mnemonic
            JMenu secondMenu = new JMenu("Second Menu");
            secondMenu.setMnemonic(KeyEvent.VK_S);
            menuBar.add(secondMenu);
            
            // Second Menu - menu items
            JMenuItem anotherMenuItem = new JMenuItem("Another Menu Item", KeyEvent.VK_A);
            anotherMenuItem.addActionListener(menuListener);
            secondMenu.add(anotherMenuItem);

            frame.setJMenuBar(menuBar);
            frame.setSize(350, 250);
            frame.setVisible(true);
          }
        }


        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Workaround:
        Disabling Windows Keyboard Navigation checkbox on display setting, will always shows mnemonics. I just tried to disable this option (control panel->display->Appearance->effects-> Hide underlined letters for keyboard Navigation until i press the Alt Key) and mnemonics always appears and able to use it properly.

        SUPPORT :
        YES

          Issue Links

            Activity

            Hide
            vdyakov Victor Dyakov added a comment -
             - this is an issue reported against 7(7u),
             - there are now affected version 9 filed for this issue
             - 7u issues are transferred to Sustaining
            Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9
            or
            7u specific escalations might be reopen to Sustaining
            Show
            vdyakov Victor Dyakov added a comment -  - this is an issue reported against 7(7u),  - there are now affected version 9 filed for this issue  - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
            Hide
            vdyakov Victor Dyakov added a comment -
             - this is an issue reported against 7(7u),
             - there are now affected version 9 filed for this issue
             - 7u issues are transferred to Sustaining
            Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9
            or
            7u specific escalations might be reopen to Sustaining
            Show
            vdyakov Victor Dyakov added a comment -  - this is an issue reported against 7(7u),  - there are now affected version 9 filed for this issue  - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
            Hide
            ssadetsky Semyon Sadetsky added a comment -
            When ALT PRESSED event comes for the second time it can be the case to clear menu focus and srokes or the case when ALT+key combination is about to be pressed. The last one was missed in the ALT key handler.
            Show
            ssadetsky Semyon Sadetsky added a comment - When ALT PRESSED event comes for the second time it can be the case to clear menu focus and srokes or the case when ALT+key combination is about to be pressed. The last one was missed in the ALT key handler.
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/f63b19d6ff4b
            User: alexsch
            Date: 2015-04-06 15:04:39 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/f63b19d6ff4b User: alexsch Date: 2015-04-06 15:04:39 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/f63b19d6ff4b
            User: lana
            Date: 2015-04-23 01:41:22 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/f63b19d6ff4b User: lana Date: 2015-04-23 01:41:22 +0000

              People

              • Assignee:
                ssadetsky Semyon Sadetsky
                Reporter:
                igor Igor Nekrestyanov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: