Example usage for javafx.scene Scene Scene

List of usage examples for javafx.scene Scene Scene

Introduction

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

Prototype

public Scene(@NamedArg("root") Parent root) 

Source Link

Document

Creates a Scene for a specific root Node.

Usage

From source file:Main.java

/**
 * Creates a popup containing error without any pretty things for a graphical way to show errors
 * @param error Error string to show/* w w w  .j a v a 2 s.  c  o  m*/
 */
public static void showError(String error) {
    if (Platform.isFxApplicationThread()) {
        Stage s = new Stage();
        VBox v = new VBox();
        v.getChildren().add(new Label("Error [" + error + ']'));
        Scene sc = new Scene(v);
        s.setTitle("Fail");
        s.setScene(sc);
        s.show();
    } else {
        Platform.runLater(() -> {
            Stage s = new Stage();
            VBox v = new VBox();
            v.getChildren().add(new Label("Error [" + error + ']'));
            Scene sc = new Scene(v);
            s.setTitle("Fail");
            s.setScene(sc);
            s.show();
        });
    }
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group(new Text(25, 25, "Hello World!")));

    stage.setTitle("Welcome to JavaFX!");
    stage.setScene(scene);// w  w w .  ja va 2 s .c o  m
    stage.sizeToScene();
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group group = new Group();
    Scene scene = new Scene(group);

    Label title = new Label("Label 1");
    StackPane stackpane = new StackPane();
    StackPane.setAlignment(title, Pos.BOTTOM_CENTER);
    stackpane.getChildren().addAll(new Label("Label"), title);

    group.getChildren().add(stackpane);/* w  ww. j a  va2  s .  c o  m*/

    stage.setTitle("Welcome to JavaFX!");
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Tooltip Sample");
    stage.setWidth(300);//from   w  w w.j ava  2 s.c o  m
    stage.setHeight(150);

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

    ((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);//w  w w  . j  a  v a 2  s.com
    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);// w w  w .  ja  va  2  s  .c  om
    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 stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);/*from  ww w  .  ja va 2 s  .  c om*/
    stage.setHeight(150);

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");
    System.out.println(toolTip.graphicProperty());
    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  a2 s .c  om
    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();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);//from   ww  w .  j ava 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.fontProperty());
    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);//w w w . ja  v  a  2s .  c o m
    stage.setHeight(150);

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

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

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