Example usage for javafx.stage Stage setScene

List of usage examples for javafx.stage Stage setScene

Introduction

In this page you can find the example usage for javafx.stage Stage setScene.

Prototype

@Override
final public void setScene(Scene value) 

Source Link

Document

Specify the scene to be used on this stage.

Usage

From source file:Main.java

@Override
public void start(final Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);//w ww.  java2  s  . c  om
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox vbox = new VBox();
    ListView list = new ListView();
    VBox.setVgrow(list, Priority.ALWAYS);
    vbox.getChildren().addAll(new Label("Names:"), list);

    scene.setRoot(vbox);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);//  ww w  .  j  av  a 2s  . c om
    stage.setHeight(150);

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip();
    toolTip.setContentDisplay(ContentDisplay.BOTTOM);

    button.setTooltip(toolTip);
    ((Group) scene.getRoot()).getChildren().add(button);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);/*from   w w w .  j a  va  2s.c om*/
    stage.setHeight(150);

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");

    toolTip.setWrapText(true);

    button.setTooltip(toolTip);

    ((Group) scene.getRoot()).getChildren().add(button);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Button btn = new Button("A big button");

    Rectangle rect = new Rectangle(100, 50);
    rect.setFill(Color.WHITE);//from  ww w . ja v  a 2 s  .c  o m
    rect.setStrokeWidth(1);
    rect.setStroke(Color.BLACK);

    HBox root = new HBox();
    root.setSpacing(20);
    root.getChildren().addAll(btn, rect);

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

    System.out.println("btn.isResizable(): " + btn.isResizable());
    System.out.println("rect.isResizable(): " + rect.isResizable());
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group group = new Group();

    Rectangle rect = new Rectangle(20, 20, 200, 200);

    rect.setStrokeWidth(2);/* w  ww.j  a  v  a 2 s .c  o  m*/

    rect.setStroke(Color.RED);
    rect.setStrokeWidth(1.5);
    rect.getStrokeDashArray().addAll(3.0, 7.0, 3.0, 7.0);

    group.getChildren().add(rect);

    Scene scene = new Scene(group, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    FlowPane flowPane = new FlowPane(Orientation.HORIZONTAL);
    flowPane.setPrefWrapLength(210);//from  w  ww .j  a va 2  s. c om
    Button btn = new Button();

    for (int i = 0; i < 8; i++) {
        btn = new Button("Button");
        btn.setPrefSize(100, 50);
        flowPane.getChildren().add(btn);
    }
    Scene scene = new Scene(flowPane);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) {
    stage.setWidth(500);//from   w ww .ja va 2 s  . co m
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();
    CategoryAxis lineXAxis = new CategoryAxis(getData());

    System.out.println(lineXAxis.getDisplayPosition("Sales"));

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

    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);/*w ww  . ja v  a2  s. co  m*/

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    System.out.println(line.endYProperty());

    box.getChildren().add(line);

    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 a  v  a2s  . co  m*/

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    System.out.println(line.endXProperty());

    box.getChildren().add(line);

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group group = new Group();

    Path spade = new Path();
    spade.getElements().add(new MoveTo(25.0f, 0.0f));
    spade.getElements()/*from  w  ww . ja  v  a2s.  c o m*/
            .add(QuadCurveToBuilder.create().controlX(40.0f).controlY(50.0f).x(27.0f).y(30.0f).build());

    group.getChildren().add(spade);

    Scene scene = new Scene(group, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}