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

[macosx] Interference on French keyboard for cmd + comma accelerator

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version " 1.7.0_40-ea "
      Java(TM) SE Runtime Environment (build 1.7.0_40-ea-b28)
      Java HotSpot(TM) 64-Bit Server VM (build 24.0-b47, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      10.7.5

      A DESCRIPTION OF THE PROBLEM :
      With French keyboard mapping, typing cmd + comma calls the action listener bound to cmd + M accelerator and the listener added to the preferences menu item of Mac OS X application menu.
      This is annoying because from OS X Human Interface Guidelines, cmd + M is supposed to be associated to " Window > Minimize " menu item.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the test case included in this report and type cmd + comma on a French keyboard.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expected that only the Preferences message dialog would appear when I type cmd + comma
      ACTUAL -
      The Preferences message dialog appeared and the main window was minimized

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.event.*;
      import javax.swing.*;
      import com.apple.eawt.AppEvent.PreferencesEvent;
      import com.apple.eawt.*;


      public class CmdCommaInterferenceOnFrenchKeyboard {
        public static void main(String [] args) {
          System.setProperty( " apple.laf.useScreenMenuBar " , " true " );
          final JFrame f = new JFrame( " CmdCommaTest " );
          f.add(new JLabel( " <html>Select French keyboard in System preferences " +
           " <br>and type cmd + comma or cmd + M shortcut " ));
          f.setJMenuBar(createMenuBar(f));
          f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          f.pack();
          Application.getApplication().setPreferencesHandler(
              new PreferencesHandler() {
                public void handlePreferences(PreferencesEvent ev) {
                  JOptionPane.showMessageDialog(f, " Preferences " );
                }
              });
          f.setVisible(true);
        }

        private static JMenuBar createMenuBar(final JFrame f) {
          JMenuBar menuBar = new JMenuBar();
          JMenu menu = new JMenu( " Window " );
          JMenuItem minimizeMenuItem = new JMenuItem( " Minimize " );
          minimizeMenuItem.setAccelerator(KeyStroke.getKeyStroke( " meta M " ));
          minimizeMenuItem.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent ev) {
                f.setState(JFrame.ICONIFIED);
              }
            });
          menuBar.add(menu);
          menu.add(minimizeMenuItem);
          return menuBar;
        }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Don't use cmd + M shortcut.

            azvegint Alexander Zvegintsev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: