RFR: 8089373: Translation from character to key code is not sufficient

Martin Fox duke at openjdk.org
Tue May 9 17:37:12 UTC 2023


On Fri, 5 May 2023 20:25:23 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/tk/Toolkit.java line 709:
>> 
>>> 707:      * The default implementation bridges into the existing getKeyCodeForChar call.
>>> 708:      */
>>> 709:     public boolean getKeyCanGenerateCharacter(KeyEvent event, String character) {
>> 
>> I think this method can be narrowed a bit to accept a `KeyCode` instead of `KeyEvent`, making it bit more generally useful (and easier to test).  Also I think perhaps it can be named a bit more direct, like `canKeyGenerateCharacter`.
>
> I forgot the `KeyEvent` is needed to extract the hardware code. Depending on whether this hardware code remains a hidden variable this may be for the best (or can pass both `KeyCode` and the hardware code).

I'll change the call over to `canKeyGenerateCharacter`, the longer form was starting to annoy me too.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1126#discussion_r1188926005


More information about the openjfx-dev mailing list