Check out example codes for "javafx center node in gridpane". It will help you in understanding the concepts better.

Code Example 1

//center grid pane:
GridPane pane = new GridPane();
pane.setAlignment(Pos.CENTER);
//center element:
GridPane.setHalignment(node, HPos.CENTER);
GridPane.setValignment(node, VPos.CENTER);

Learn ReactJs, React Native from akashmittal.com