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

KeyStroke.getKeyStroke(String s) does not function as documented

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 5.0
    • client-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      The Javadoc states the following format for Keystroke.getKeyStroke(String s)'s String argument:

      <modifiers>* (<typedID> | <pressedReleasedID>)

          modifiers := shift | control | ctrl | meta | alt | altGraph
          typedID := typed <typedKey>
          typedKey := string of length 1 giving Unicode character.
          pressedReleasedID := (pressed | released) key
          key := KeyEvent key code name, i.e. the name following "VK_".

      In fact, sometimes the key's symbol works, and other times, "the name following VK_" (KeyEvent.VK*) is indeed required. For example:

      KeyStroke.getKeyStroke("typed >") will return you a valid KeyStroke object, but KeyStroke.getKeyStroke("pressed >") will give you null. KeyStroke.getKeyStroke("pressed GREATER") gives you a valid, but apparently non-functional KeyStroke object.

      More examples: "typed [" is accepted but "typed ;" is not. According to the javadoc, "typed OPEN_BRACKET" (or perhaps "typed open_bracket") should be required for the former, and "typed SEMICOLON" for the latter.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See description.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      See description.
      ACTUAL -
      See description.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      See description.

      REPRODUCIBILITY :
      This bug can be reproduced always.

            yan Yuri Nesterenko
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: