Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

KeyEvent key code problem

854531Jun 3 2011 — edited Jun 3 2011
This is about JavaFX 2.0.

For the code fragment:
......
flow.setOnKeyPressed(new EventHandler<KeyEvent>() {
            public void handle(KeyEvent keyEvent) {
                      .....
When the SLASH key is pressed, breaking at the first line of the method "handle" gives keyEvent.getCode().ordinal() being 187. When the MINUS key is pressed, keyEvent.getCode().ordinal() is STILL 187. Previously in JavaFX 1.3, the code ordinal was 23 for SLASH and 21 for MINUS. Now I cannot tell which key is pressed! Yes I can look at the keyEvent.getText() property... but it really seems like a bug that the code is UNDEFINED, right?

Thanks everyone :)

Edited by: 851528 on Jun 3, 2011 12:10 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 1 2011
Added on Jun 3 2011
3 comments
221 views