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(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    BarChart barChart = new BarChart(xAxis, yAxis, getChartData(), 0.2);
    barChart.setTitle("A");
    primaryStage.setTitle("BarChart example");

    StackPane root = new StackPane();
    root.getChildren().add(barChart);// w  ww .  jav a2s . c om
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.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  .jav  a2 s  . c o 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.startYProperty());

    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);//  w w  w.  jav a 2s  . 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.startXProperty());

    box.getChildren().add(line);

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    Rectangle r = new Rectangle();
    r.setX(50);/*  w  ww  . j  a va  2s .co  m*/
    r.setY(50);
    r.setWidth(200);
    r.setHeight(100);
    r.setArcWidth(20);
    r.setArcHeight(20);

    root.getChildren().add(r);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    ArcTo arcTo = new ArcTo();
    arcTo.setX(20);//from   w w w.  j  a  v  a2  s  .  co m
    arcTo.setY(30);

    arcTo.setRadiusX(30);
    arcTo.setRadiusY(30);

    Path path = new Path(new MoveTo(0, 0), new VLineTo(100), new HLineTo(100), new VLineTo(50), arcTo);
    HBox box = new HBox(path);

    box.setSpacing(10);

    Scene scene = new Scene(box);
    stage.setScene(scene);
    stage.setTitle("Test");
    stage.show();
}

From source file:Main.java

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

    HBox hbox = new HBox();

    Label label1 = new Label("Search");
    label1.setFont(new Font("Arial", 30));

    hbox.setSpacing(10);
    hbox.getChildren().add((label1));
    ((Group) scene.getRoot()).getChildren().add(hbox);

    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);//  www.  ja va2  s .com
    stage.setHeight(150);

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");
    System.out.println(toolTip.getText());
    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 v  a 2 s  .c o m*/
    stage.setHeight(150);

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");
    System.out.println(toolTip.getFont());
    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) {
    Text text = new Text("Transparent!");
    text.setFont(new Font(40));

    MotionBlur mb = new MotionBlur();
    mb.setRadius(15.0);/*from   ww w.j av  a  2 s  . c  o  m*/
    mb.setAngle(-30.0);

    text.setEffect(mb);

    VBox box = new VBox();
    box.getChildren().add(text);
    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) {
    ChoiceBox<String> choiceBox = new ChoiceBox<String>();
    choiceBox.setItems(cursors);/*ww w. ja  v  a 2 s.c  o m*/

    SingleSelectionModel ssm = choiceBox.getSelectionModel();
    choiceBox.setSelectionModel(ssm);

    VBox box = new VBox();
    box.getChildren().add(choiceBox);
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
}