Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFx: make progressbar indeterminate

Tags:

java

javafx

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?

like image 739
Pavel_K Avatar asked Jul 24 '15 14:07

Pavel_K


1 Answers

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.

like image 174
aw-think Avatar answered Oct 15 '22 10:10

aw-think