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

Util.hitMnemonics does not work: getSystemMnemonicKeyCodes() returns ALT_MASK rather than VK_ALT

XMLWordPrintable

    • b45
    • 9
    • b76

        New implementation of test/swing/regtesthelpers/Util.getSystemMnemonicKeyCodes is not correct.

        It combines key codes and key masks:

            public static ArrayList<Integer> getSystemMnemonicKeyCodes() {
                String osName = System.getProperty("os.name");
                ArrayList<Integer> result = new ArrayList<>();
                if (osName.contains("OS X")) {
                    result.add(KeyEvent.VK_CONTROL);
                }
                result.add(KeyEvent.ALT_MASK);
                return result;
            }

        KeyEvent.VK_CONTROL and KeyEvent.ALT_MASK are combined, and then interpreted as key codes by hitMnemonics but KeyEvent.ALT_MASK is not a key code. Therefore tests which use Util.hitMnemonics fail now, for example test javax/swing/JFileChooser/8002077/bug8002077.java.

              aivanov Alexey Ivanov
              aivanov Alexey Ivanov
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: