API Review Request for RT-17438
Jeff McDonald
deep.blue.6802 at gmail.com
Fri Apr 13 12:30:31 PDT 2012
+1 for me.
Some random thoughts:
- White space typically includes newlines, and the isWhitespace method
returns true only for tabs and spaces. The documentations makes it clear
what the method does, but it wouldn't be a stretch for a developer to
assume that white space includes newlines. ... especially developers that
do a lot of work with HTML.
- "FunctionKey" is more common usage than "FunctionalKey"
- 10 key numeric keypads typically map arrow keys on to the 2 (Down Arrow),
4 (Left Arrow), 6 (Right Arrow), 8 (Up arrow) keys. Do these keys return
true for isArrowKey()?
Make the methods public so that a method such as isWhitespace could be made
to detect newlines. Extendability allows the methods to be overridden for
other things such as custom keyboards or internationalized keyboards.
Cheers,
Jeff
On Fri, Apr 13, 2012 at 12:31 AM, Martin Sladecek <
martin.sladecek at oracle.com> wrote:
> Hello,
>
> JIRA: http://javafx-jira.kenai.com/**browse/RT-17438<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