10. Triggers
As you saw in the preceding chapter, binding enables you to link the state of one variable to another, relieving you of the responsibility of writing the largely boilerplate code that would be required to achieve the same effect in a Java application. Sometimes when the value of variable changes you need to do something more than a mechanical update of all the state in the application that directly depends on that variable. Triggers give you the ability to execute arbitrary code whenever the value of a script variable or an instance variable is changed. In this chapter, you see how to declare a trigger and what can be done when a trigger is executed.
The source code for this chapter is in the javafxtriggers
package in the JavaFX ...
Get JavaFX™ Developer’s Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.