How to position controls binding there position into the stage's size using the controller class in JavaFx?
<p>I found some thing similar in this link 
<a href="https://stackoverflow.com/questions/16636286/how-to-call-functions-on-the-stage-in-javafxs-controller-file?rq=1">How to call functions on the stage in JavaFX's controller file</a></p>

<p>and here is what I found in one of the answers</p>

<p>StageTrackingSample.java    </p>

<pre><code>public class StageTrackingSample extends Application {

  @Override public void start(final Stage stage) throws Exception {
final FXMLLoader loader = new FXMLLoader(
  getClass().getResource(
    "stagetracking.fxml"
  )
);

final Parent root = (Parent) loader.load();
final StageTrackingController controller = loader.getController();
controller.initData(stage);
stage.setScene(new Scene(root));
stage.show();
  }

  public static void main(String[] args) { launch(args); }
} 
</code></pre>

<p>StageTrackingController.java</p>

<pre><code>public class StageTrackingController {

@FXML private Label stageX;
public void initialize() {}  
public void initData(final Stage stage) {
 stageX.textProperty().bind(
  Bindings.format(
    "(%1$.2f, %2$.2f)", 
    stage.xProperty(), 
    stage.yProperty()
    )
   );
 }
}
</code></pre>

<p>I wanted to position the progressIndicator in the middle of the window, so I tried this in my controller class
Controller.java</p>

<pre><code> public void initInterface(Stage stage) {

       progressIndicator.layoutXProperty().bind(stage.widthProperty().divide(2));
       progressIndicator.layoutYProperty().bind(stage.heightProperty().divide(2));
 }
</code></pre>

<p>and this in Main.java</p>

<pre><code>public class Main extends Application {

@Override
public void start(Stage primaryStage) throws Exception{
    final FXMLLoader loader = new FXMLLoader(getClass().getResource("sample.fxml"));
    primaryStage.setTitle("Hello World");
    final Parent root = loader.load();
    final Controller controller = loader.getController();
    final Scene scene = new Scene(root);
    controller.initInterface(primaryStage);
    primaryStage.setScene(scene);
    primaryStage.show();

 }


public static void main(String[] args) {
    launch(args);
 }
}
</code></pre>

<p>it doesn't work even when I tried passing the scene or the anchorpane(which is defined in the fxml file) as a parameter into initInterface method, it seems that it has problem with binding progressIndicator properties</p>