Selection Events v. Focus Events - order is broken in JavaFX 8?

Scott Palmer swpalmer at
Tue Feb 10 15:15:00 UTC 2015

I have a custom field (my own formatted field done in JavaFX 2.2) bound to
a property of the selected row in a TableView. My control commits an edit
on focus lost.

This works on JavaFX 2.2 but fails on JavaFX 8.  After a bit of debugging I
discovered why. The way to reproduce the problem was to type something into
the field and then select a different row in the table.   With JavaFX 2.2
the edit is committed and then the control is populated with the data from
the new selection.  With JavaFX 8, the selection change event happens prior
to the focus lost event, so my control's data is replaced without being

This smells like a rather serious bug in JavaFX 8.  The TableView selection
should not change as the result of a mouse click prior to the TableView
getting the focus (and thus my control losing the focus and committing the
edit to the selected item before the selection changes).

Do you agree that this is broken behavior?
Do you have an idea of how to work around it?



More information about the openjfx-dev mailing list