VBox.getSpacing() has the following syntax.
public final double getSpacing()
In the following code shows how to use VBox.getSpacing() method.
/*from www. j a v a 2s .c om*/ import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("VBox Test"); VBox vb = new VBox(); vb.setPadding(new Insets(10, 50, 50, 50)); vb.setSpacing(10); vb.setAlignment(Pos.BASELINE_LEFT); System.out.println(vb.getSpacing()); Label lbl = new Label("VBox"); lbl.setFont(Font.font("Amble CN", FontWeight.BOLD, 24)); vb.getChildren().add(lbl); Button btn1 = new Button(); btn1.setText("Button1"); vb.getChildren().add(btn1); Button btn2 = new Button(); btn2.setText("Button2"); vb.getChildren().add(btn2); Button btn3 = new Button(); btn3.setText("Button3"); vb.getChildren().add(btn3); Button btn4 = new Button(); btn4.setText("Button4"); vb.getChildren().add(btn4); // Adding VBox to the scene Scene scene = new Scene(vb); primaryStage.setScene(scene); primaryStage.show(); } }