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

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

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b45
    • Introduced In Version:
      9
    • Resolved In Build:
      b76

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                aivanov Alexey Ivanov
                Reporter:
                aivanov Alexey Ivanov
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: