Using Properties to Create Dynamic Scenes
In This Chapter
Introducing and creating properties
Working with read-only and read/write properties
Adding event listeners to your properties
Binding properties together
In this chapter, you discover how to use a powerful feature of JavaFX — properties. Simply put, a JavaFX property is an observable value that’s exposed by a class. Properties are observable in the sense that you can attach listeners to them. These listeners can be invoked whenever the value of the property changes or becomes unknown.
One of the best features of properties is that you can bind to them, or connect properties together so that when one property changes, the other property is adjusted automatically. In other words, binding allows two properties to be synchronized. When one property changes, the other property changes as well.
In this chapter, I discuss the basics of working with properties. First, you read about how to create your own properties. Then, you figure out how to attach listeners to properties so your code can respond when the property ...