Using a ProgressBar

The ProgressBar control is a specialization of the ProgressIndicator that displays the progress of an operation as a bar. The following snippet contains the code that creates the ProgressBar and keeps its progress property updated from the relevant instance variables in the model.

final ProgressBar progressBar = new ProgressBar();
progressBar.setPrefWidth(200);
progressBar.progressProperty().bind(model.kph.divide(model.maxKph));

As a result of the bind shown in this snippet, when the kph variable in the StarterAppModel class is negative, the progress property of the ProgressBar becomes negative. This causes the ProgressBar to assume the indeterminate appearance that you experienced in Step 29. Now we move away from the UI controls that graphically represent numeric values in various ranges, toward the controls that deal with HTML and other web-related content.