Example usage for javafx.scene.layout VBox VBox

List of usage examples for javafx.scene.layout VBox VBox

Introduction

In this page you can find the example usage for javafx.scene.layout VBox VBox.

Prototype

public VBox() 

Source Link

Document

Creates a VBox layout with spacing = 0 and alignment at TOP_LEFT.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Text msg = new Text("Hello JavaFX");
    VBox root = new VBox();
    root.getChildren().add(msg);/*from ww w .j  a v  a2s  . c  o m*/

    Scene scene = new Scene(root, 300, 50);
    stage.setScene(scene);
    stage.setTitle("Hello JavaFX Application with a Scene");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Button b1 = new Button("Close");

    VBox root = new VBox();
    root.getChildren().addAll(b1);// w ww .  ja v a 2s  .co m

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("");
    stage.show();

    System.out.println("b1(layoutBounds)=" + b1.getLayoutBounds());
    System.out.println("b1(boundsInLocal)=" + b1.getBoundsInLocal());
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/*w w w. j  ava2s.c  o m*/
    Stop[] stops = new Stop[] { new Stop(0, Color.BLACK), new Stop(1, Color.RED) };
    LinearGradient lg1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops);

    Rectangle r1 = new Rectangle(0, 0, 100, 100);
    r1.setFill(lg1);

    box.getChildren().add(r1);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);//from  w w w.  j  av  a2 s.co m
    stage.setHeight(500);
    Scene scene = new Scene(new Group());
    VBox root = new VBox();
    Hyperlink link = new Hyperlink("www.java2s.com");

    root.getChildren().addAll(link);
    scene.setRoot(root);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.initStyle(StageStyle.UTILITY);
    Text text = new Text("!");
    text.setFont(new Font(40));
    VBox box = new VBox();
    box.getChildren().add(text);//from  w w  w.ja v a 2 s .co  m
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.initStyle(StageStyle.DECORATED);
    Text text = new Text("!");
    text.setFont(new Font(40));
    VBox box = new VBox();
    box.getChildren().add(text);//from   w w  w .  j  av  a2 s.  c om
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Label msg = new Label("java2s.com");
    msg.setStyle("-fx-text-fill: blue;");

    VBox root = new VBox();
    root.getChildren().add(msg);/* w  ww  .j a v a 2  s. c  o  m*/

    Scene scene = new Scene(root, 300, 50);
    stage.setScene(scene);
    stage.setTitle("Hello JavaFX Application with a Scene");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Text text = new Text("!");
    text.setFont(new Font(40));
    VBox box = new VBox();
    box.getChildren().add(text);/*  w  w w. j  a  v a  2s . c  o m*/
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
    stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
        public void handle(WindowEvent we) {
            System.out.println("Stage is closing");
        }
    });
    stage.close();

}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/*from w w w. j av a  2s .co m*/
    // A rectangle filled with a linear gradient with a translucent color.
    Rectangle rectangle = new Rectangle();
    rectangle.setX(50);
    rectangle.setY(50);
    rectangle.setWidth(100);
    rectangle.setHeight(70);

    LinearGradient cycleGrad = new LinearGradient(50, // start X
            50, // start Y
            70, // end X
            70, // end Y
            false, // proportional
            CycleMethod.REFLECT, // cycleMethod
            new Stop(0f, Color.rgb(21, 25, 0, .784)), new Stop(1.0f, Color.rgb(0, 210, 0, .784)));
    rectangle.setFill(cycleGrad);

    box.getChildren().add(rectangle);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);//from ww  w  .  j ava 2  s  .  c  om
    // A rectangle filled with a linear gradient with a translucent color.
    Rectangle rectangle = new Rectangle();
    rectangle.setX(50);
    rectangle.setY(50);
    rectangle.setWidth(100);
    rectangle.setHeight(70);

    LinearGradient linearGrad = new LinearGradient(0, // start X 
            0, // start Y
            0, // end X
            1, // end Y
            true, // proportional
            CycleMethod.NO_CYCLE, // cycle colors
            // stops
            new Stop(0.1f, Color.rgb(25, 200, 0, .4)), new Stop(1.0f, Color.rgb(0, 0, 0, .1)));
    rectangle.setFill(linearGrad);

    box.getChildren().add(rectangle);

    stage.setScene(scene);
    stage.show();
}