Java VBox(double spacing) Constructor

Syntax

VBox(double spacing) constructor from VBox has the following syntax.

public VBox(double spacing)

Example

In the following code shows how to use VBox.VBox(double spacing) constructor.


/*from w w  w .j av  a2  s . c  o m*/
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
 
public class Main extends Application {

    @Override
    public void start(final Stage stage) {
        stage.setTitle("HTML");
        stage.setWidth(500);
        stage.setHeight(500);
        Scene scene = new Scene(new Group());
 
        VBox vbox = new VBox(8); // spacing = 8
        vbox.getChildren().addAll(new Button("Cut"), new Button("Copy"), new Button("Paste"));
        
        scene.setRoot(vbox);

        stage.setScene(scene);
        stage.show();
    }
 
    public static void main(String[] args) {
        launch(args);
    }
}




















Home »
  Java Tutorial »
    javafx.scene.layout »




BorderPane
FlowPane
HBox
TilePane
TitledPane
VBox