Chapter 15

Using Properties to Create Dynamic Scenes

In This Chapter

arrow Introducing and creating properties

arrow Working with read-only and read/write properties

arrow Adding event listeners to your properties

arrow 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 ...

Get JavaFX For Dummies now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.