final ProgressIndicator progressIndicator = new ProgressIndicator();
progressIndicator.setPrefWidth(200);
progressIndicator.progressProperty().bind(model.rpm.divide(model.maxRpm));
ProgressIndicator
Defining a ProgressIndicator
The ProgressIndicator control displays the progress of an operation, either expressed as percent complete or indeterminate. The following snippet contains the code that creates the ProgressIndicator and keeps its progress property updated from the relevant instance variables in the model.
As a result of the bind shown in this snippet, when the rpm variable in the StarterAppModel class is negative, the progress property of the ProgressIndicator becomes negative. This causes the ProgressIndicator to assume the indeterminate appearance that you experienced in Step 28 of the exercise. Note that we’re using the Fluent API covered in Chapter 4 in the bind expression.