API Review Request for RT-17438

Martin Sladecek martin.sladecek at oracle.com
Thu Apr 12 23:31:30 PDT 2012


Hello,

JIRA: http://javafx-jira.kenai.com/browse/RT-17438

The JIRA requests methods for key classification on KeyEvent class, like

KeyEvent.isFunctionKey() //F1, F2, F3, ..., F24

KeyEvent.isArrowKey() //UP, DOWN, LEFT, RIGHT.


I propose to have these methods on KeyCode class (enum), where they are 
more natural and can be used anywhere the KeyCode objects are present 
(e.g. KeyCodeCombination class).
So in case of the keyEvent, the calls would look like:

ev.getCode().isArrowKey()


The list of propsed KeyCode methods:

/**
      * Functional keys like F1, F2, etc...
      * @return true if this key code corresponds to a functional key
      */
     public final boolean isFunctionalKey()

     /**
      * Navigation keys are arrow keys and Page Down, Page Up, Home, End
      * @return true if this key code corresponds to a navigation key
      */
     public final boolean isNavigationKey()

     /**
      * Left, right, up, down keys (including the keypad arrows)
      * @return true if this key code corresponds to an arrow key
      */
     public final boolean isArrowKey()

     /**
      * Keys that could act as a modifier
      * @return true if this key code corresponds to a modifier key
      */
     public final boolean isModifierKey()

     /**
      * All keys with letters
      * @return true if this key code corresponds to a letter key
      */
     public final boolean isLetterKey()

     /**
      * All Digit keys (including the keypad digits)
      * @return true if this key code corresponds to a digit key
      */
     public final boolean isDigitKey()

     /**
      * All keys on the keypad
      * @return true if this key code corresponds to a keypad key
      */
     public final boolean isKeypadKey()

     /**
      * Space and tab
      * @return true if this key code corresponds to a whitespace key
      */
     public final boolean isWhitespaceKey()

     /**
      * All multimedia keys (channel up/down, volume control, etc...)
      * @return true if this key code corresponds to a media key
      */
     public final boolean isMediaKey()


Thanks,
-Martin



More information about the openjfx-dev mailing list