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 stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);// w  ww  . java 2s  .co  m
    stage.setHeight(150);

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");
    System.out.println(toolTip.getGraphicTextGap());
    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  .ja v a2  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.getContentDisplay());
    button.setTooltip(toolTip);

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

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");

    Group rectangleGroup = new Group();
    Scene scene = new Scene(rectangleGroup, 550, 250);

    Rectangle rect = new Rectangle();
    rect.setWidth(100);/*from w  w  w  . j  a va2  s. c  o m*/
    rect.setHeight(100);
    rect.setTranslateX(135);
    rect.setTranslateY(11.0);

    rectangleGroup.getChildren().add(rect);

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    AreaChart areaChart = new AreaChart(xAxis, yAxis, getChartData());

    areaChart.setTitle("speculations");
    primaryStage.setTitle("AreaChart example");

    StackPane root = new StackPane();
    root.getChildren().add(areaChart);//from   w w  w.j  a va  2s.c  o m
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:Main.java

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

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");
    System.out.println(toolTip.activatedProperty());
    button.setTooltip(toolTip);

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

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

From source file:Main.java

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

    Ellipse bigCircle = new Ellipse(20, 20);
    bigCircle.setCenterX(20);//from ww  w .  j a  v  a  2 s. co m
    bigCircle.setCenterY(20);
    bigCircle.setRadiusX(10);
    bigCircle.setRadiusY(10);

    root.getChildren().add(bigCircle);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    DoubleProperty translate = new SimpleDoubleProperty();
    stage.setTitle("Hello JavaFX");
    Rectangle node1 = RectangleBuilder.create().x(0).y(0).width(10).height(10).fill(Color.RED).build();
    node1.translateXProperty().bind(translate);

    Parent parent = GroupBuilder.create().children(node1).translateX(250).translateY(250).build();
    stage.setScene(SceneBuilder.create().width(500).height(500).root(parent).build());
    stage.show();//from  w  w  w .j  ava  2s. co m

    TimelineBuilder.create().cycleCount(Timeline.INDEFINITE)
            .keyFrames(new KeyFrame(Duration.seconds(0), new KeyValue(translate, -50)),
                    new KeyFrame(Duration.seconds(2), new KeyValue(translate, 250)))
            .build().play();
}

From source file:RemoveDuplicateFiles.java

public RemoveDuplicateFiles(Stage primaryStage) {
    //Setup the PrimaryStage and make it visible.    
    Scene scene = makeScene();/*from   w  w  w .ja v a 2 s  .co  m*/

    primaryStage.setTitle("File Utilities");
    primaryStage.setScene(scene);

    addActionHandlers(primaryStage);

    primaryStage.show();

}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");
    Group root = new Group();
    Scene scene = new Scene(root, 550, 250, Color.web("0x0000FF"));

    Text text = new Text(50, 100, "JavaFX 2.0 from Java2s.com");
    Font sanSerif = Font.font("Dialog", 30);
    text.setFont(sanSerif);/*from   www  .j  av  a 2s  . c om*/
    text.setFill(Color.RED);
    root.getChildren().add(text);

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

From source file:Main.java

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

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");
    System.out.println(toolTip.contentDisplayProperty());
    button.setTooltip(toolTip);

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

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