|SOLVED JavaFX event bubbling bug in Eclipse Oxygen? [message #1799443]
||Thu, 06 December 2018 20:24
| Phil Freihofner
Registered: May 2010
SOLVED (I would delete this if I could, because I have not been able to recreate the error. The error as stated here likely does not exist.)|
I did some searches and did not find mention of this. The problem occurs with both Java8 and Java9, using Oxygen 3a.
TLDR: in Oxygen 3a, JavaFX key events are not being allowed to affect controls prior to event handling execution in the convenience methods .onKeyPressed and .onKeyReleased, as they should.
The error as I encountered it:
I have a row of JavaFX controls on the bottom of my GUI. I was using the "convenience method" .onKeyPressed(eventHandler) to call a custom key-event handler. The goal was for the arrow keys to work as follows:
LEFT, RIGHT: move the focus left or right between the various controls
UP, DOWN: change the values on the controls.
From within Eclipse, the GUI operated as desired. But when I compiled the program and executed it from the jar, the controls acted as if they were receiving an additional instance of the keystroke despite the fact that the keystroke is consumed in the key handling code. For example, pressing RIGHT while the focus was on a ScrollBar incremented the ScrollBar (undesired) in addition to moving the focus rightward to the next control (desired).
Looking at some API documentation, I discovered that the convenience methods are processed at the end of the event bubbling chain, and that it takes an event filter [e.g., using the method .addEventFilter(event, handler)] to intercept the keystroke prior to processing. Thus I changed my implementation to make use of event filters and behavior is now both consistent (both within the IDE and executing from compiled) and as desired.
BUT, it seems to me that Eclipse is not properly executing JavaFX "convenience methods". The methods .keyPressed(handler) and .keyReleased(handler) should allow the key to affect the target control prior to executing the handler routine. I should not have had this undesired behavior only show up after compiling!
I am putting this question here as I am unfamiliar with the bug reporting process, or even if this is a bona fide bug or has been reported before. Is this post sufficient, or is there more I need to do to properly report this?
[Updated on: Tue, 11 December 2018 05:07]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02538 seconds