API Review Request for RT-17438
Martin Sladecek
martin.sladecek at oracle.com
Mon Apr 16 00:31:39 PDT 2012
On 04/13/2012 09:30 PM, Jeff McDonald wrote:
> +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.
OK, I think we can also add Enter to the whitespace category.
> - "FunctionKey" is more common usage than "FunctionalKey"
Right, thanks.
> - 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()?
There are separate keycodes for them depending on the numlock status
(KP_LEFT, KP_RIGHT, ... or NUMPAD0, NUMPAD1, ...).
>
> 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.
Not sure what you mean, there are already public, but KeyCode is an
enum, so you can't extend from it.
-Martin
>
> 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