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

[macosx] getKeyCode() return the wrong value for CTRL+Z on a fr_CH keyboard

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      FULL PRODUCT VERSION :
      java version "1.7.0_04-ea"
      Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 23.0-b16, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      MacOS X 10.7.3 (Lion)

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      swiss french keyboard

      A DESCRIPTION OF THE PROBLEM :
      If i type CTRL+Z KeyEvent.getKeyChar returns 89 instead 90 on a fr_CH keyboard in JDK 7 on MacOS X10.7.3
      If i type CTRL+Y KeyEvent.getKeyChar returns 90 instead 89
      The same synptom is appear also with the ALT+ modifier.
      With the SHIFT+ and META+ modifiers it works.

      REGRESSION. Last worked in version 6u29

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {
              int onmask = KeyEvent.SHIFT_DOWN_MASK;
              int offmask = 0;
              if ((evt.getModifiersEx() & (onmask | offmask)) == onmask && evt.getKeyCode() == KeyEvent.VK_Z) {
                  // do some thing
                 }
          }

      or

      KeyStroke CTRL_Z = KeyStroke.getKeyStroke(KeyEvent.VK_Z,KeyEvent.CTRL_MASK);
      jTextField1.getInputMap(JComponent.WHEN_FOCUSED).put(CTRL_Z,"zoomPanel");
      jTextField1.getActionMap().put("zoomPanel", new javax.swing.AbstractAction() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
              zoomPanel();
          }
      });

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      CTRL+Z -> 90
      CTRL+Y-> 89

      ALT+Z -> 90
      ALT+Y-> 89
      ACTUAL -
      CTRL+Z -> 89
      CTRL+Y-> 90

      ALT+Z -> 89
      ALT+Y-> 90

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {
              int onmask = KeyEvent.SHIFT_DOWN_MASK;
              int offmask = 0;
              if ((evt.getModifiersEx() & (onmask | offmask)) == onmask && evt.getKeyCode() == KeyEvent.VK_Z) {
                  // do some thing
                 }
          }

      or

      KeyStroke CTRL_Z = KeyStroke.getKeyStroke(KeyEvent.VK_Z,KeyEvent.CTRL_MASK);
      jTextField1.getInputMap(JComponent.WHEN_FOCUSED).put(CTRL_Z,"zoomPanel");
      jTextField1.getActionMap().put("zoomPanel", new javax.swing.AbstractAction() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
              zoomPanel();
          }
      });
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pchelko Petr Pchelko (Inactive)
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: