Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

    <p>The code above generates the following result.</p><myImage src='longtutorial/JavaImage/JavaFX/JavaFX_VBox_Example_2.PNG'></myImage>===SectionShortTitle:VBox with spacing SectionLongTitle:VBox with spacing SectionContent:<myPreCode>VBox vbox=new VBox(8); // spacing = 8
    vbox.getChildren().addAll(new Button("Cut"),new Button("Copy"),new Button("Paste"));</myPreCode><myTogglePreCode>

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);
    }
    }</myTogglePreCode><p>The code
    above generates
    the following result.</p><myImage src='longtutorial/JavaImage/JavaFX/JavaFX_VBox_VBox_with_spacing.PNG'></myImage>
===
SectionShortTitle:Set Padding
    and Spacing SectionLongTitle:Set Padding
    and Spacing SectionContent: