

Listeners and Events
Table of Contents
ChangeListeners are way to manually monitor a Property for changes in its value, and then to trigger some code when a change happens.
90%+ of the functionality that you need to build in a Reactive application can be achieved via Bindings, which allow the “State” of your application to be share back and forth with the Nodes that make up your GUI. But, sometimes you need an “Action” to take place in response to some change in your Presentation Model, or in one of the Properties inside a screen Node. In those cases you’ll need to use a Listener to listen for the change to take place and trigger your code.
ChangeListeners are way to manually monitor a Property for changes in its value, and then to trigger some code when a change happens. Generally speaking, Bindings are much preferred over listeners, but there are times when only a listener will work. The reason for this is that Bindings link “State”, while ChangeListeners transform changes in “State” to actions. Programming to State is usually better, but events work better in some circumstances, such as when you need to deal with some part of your application outside the JavaFX domain that doesn’t understand JavaFX observables.
The Articles#


EventHandlers, Listeners and Bindings - What to Use Where

Use Subscriptions Instead of Listeners


