user5182503
user5182503

Reputation:

JavaFx: make progressbar indeterminate

I have a ProgressBar in javafx fxml file. How can I make it indeterminate in controller?

EDIT 1 In javafx scenebuilder you can make a progressbar indeterminate via checkbox. So, I want to do it in controller. By other words, how can I do it via code?

Upvotes: 8

Views: 11739

Answers (1)

aw-think
aw-think

Reputation: 4803

Assumption/Solution

As you do not provide enough code, like you normally should MCVE, I will assume you need the following controller code:

public class FXMLDocumentController {

  @FXML
  private ProgressBar bar;

  @FXML
  private void initialize() {
    bar.setProgress(ProgressBar.INDETERMINATE_PROGRESS);
  }

}

This simply sets the Progress to -1.

Upvotes: 25

Related Questions