Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » SOLVED JavaFX event bubbling bug in Eclipse Oxygen?(JavaFX event bubbling different within Eclipse and compiled (Jar))
SOLVED JavaFX event bubbling bug in Eclipse Oxygen? [message #1799443] Thu, 06 December 2018 20:24 Go to next message
Phil Freihofner is currently offline Phil FreihofnerFriend
Messages: 38
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

Re: SOLVED JavaFX event bubbling bug in Eclipse Oxygen? [message #1799606 is a reply to message #1799443] Tue, 11 December 2018 05:06 Go to previous message
Phil Freihofner is currently offline Phil FreihofnerFriend
Messages: 38
Registered: May 2010
I have been unable to recreate the error, either as a self contained example, or from my original code.

As far as I can tell, the KeyEvent bubbling in Eclipse is now, and was initially working perfectly well. I do not know how to explain the behavior that I observed.

My apologies to the Forum. If there is a way to delete this thread, I would love to know how I might accomplish this.

[Updated on: Tue, 11 December 2018 05:08]

Report message to a moderator

Previous Topic:stackoverflow didn't solve no projects are found to import problem
Next Topic:Unreadable entry fields in dialogs
Goto Forum:

Current Time: Fri Feb 28 22:45:13 GMT 2020

Powered by FUDForum. Page generated in 0.02538 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top