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:com.kotcrab.vis.editor.CrashReporter.java

@Override
public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("crash-reporter-layout.fxml"));

    Scene scene = new Scene(root);

    stage.setTitle("VisEditor Crash Reporter");
    stage.getIcons().add(new Image(CrashReporter.class.getResourceAsStream("icon.png")));
    stage.setScene(scene);
    stage.setResizable(false);//from   www. ja  va  2s. com
    stage.sizeToScene();
    stage.show();
}

From source file:io.bitsquare.app.BitsquareApp.java

private void showDebugWindow() {
    ViewLoader viewLoader = injector.getInstance(ViewLoader.class);
    View debugView = viewLoader.load(DebugView.class);
    Parent parent = (Parent) debugView.getRoot();
    Stage stage = new Stage();
    stage.setScene(new Scene(parent));
    stage.setTitle("Debug window");
    stage.initModality(Modality.NONE);/*from   w w  w.j  a v a  2s.  c o m*/
    stage.initStyle(StageStyle.UTILITY);
    stage.initOwner(scene.getWindow());
    stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10);
    stage.setY(primaryStage.getY());
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Drawing Text");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);
    int x = 100;/* ww w.jav  a 2s. c om*/
    int y = 100;
    int red = 30;
    int green = 40;
    int blue = 50;

    Text text = new Text(x, y, "JavaFX 2.0");

    text.setFill(Color.rgb(red, green, blue, .99));
    text.setRotate(60);
    root.getChildren().add(text);

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

From source file:Main.java

@Override
public void start(final Stage stage) {
    stage.setTitle("");
    stage.setWidth(500);// www. j a v a2  s  . c o m
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();

    NumberAxis yAxis = new NumberAxis(0.0, 5.0, 1.0);
    NumberAxis xAxis = new NumberAxis(0.0, 5.0, 1.0);
    ScatterChart scatterChart = new ScatterChart(xAxis, yAxis);

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

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

From source file:aajavafx.LoginController.java

@FXML
private void handleButtonLoginAction(ActionEvent event) {

    try {//www .  j  a v a 2 s.  c om

        username_var = userID.getText().toString();
        password_var = passwordID.getText().toString();
        Kripto myKripto = new Kripto();
        System.out.println(myKripto.encrypt(password_var));

        if (saveCredentials.isSelected()) {
            UserCredentials userCred = new UserCredentials(username_var, password_var);
            try (ObjectOutputStream out = new ObjectOutputStream(Files.newOutputStream(savedCredentials))) {
                out.writeObject(userCred);
            } catch (IOException ex) {
                System.out.println("IO Exception: " + ex);
            } catch (Exception ex) {
                System.out.println("Exception: " + ex);
                ;
            }
        }

        //////Check password disabled 

        //  String passwordCypherFromDB = getPassword(username_var);
        //  String passwordFromDB = myKripto.decrypt(passwordCypherFromDB);
        //   if (passwordFromDB.equals(password_var)) {
        Node node = (Node) event.getSource();
        Stage stage = (Stage) node.getScene().getWindow();

        FXMLLoader loader = new FXMLLoader(getClass().getResource("MainPageTab.fxml"));
        Parent root = loader.load();

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

        System.out.println("Taking you to next page!");
        //  } else {
        //     outputmessageID.setText("Login failed!!!!");
        // }
    } catch (Exception ex) {
        System.out.println("LOAD PAGE EXCEPTION: " + ex);
    }

    System.out.println("You clicked me!");

}

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();
    bigCircle.setCenterX(20);/*from   w ww.j  a va 2  s.c om*/
    bigCircle.setCenterY(20);
    bigCircle.setRadiusX(10);
    bigCircle.setRadiusY(10);

    System.out.println(bigCircle.centerXProperty().doubleValue());

    root.getChildren().add(bigCircle);

    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);//  w w  w .ja v  a2s .  com
    stage.setHeight(150);

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");
    Node icon = new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    toolTip.setGraphic(icon);

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

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

From source file:Main.java

@Override
public void start(final Stage stage) {
    stage.setTitle("");
    stage.setWidth(500);//from ww w .  j a v a2 s  . com
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();
    NumberAxis lineYAxis = new NumberAxis(0, 100, 10);
    CategoryAxis lineXAxis = new CategoryAxis();

    lineYAxis.setLabel("Sales");
    lineXAxis.setLabel("Products");

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

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Parameters p = this.getParameters();
    Map<String, String> namedParams = p.getNamed();
    List<String> unnamedParams = p.getUnnamed();
    List<String> rawParams = p.getRaw();

    String paramStr = "Named Parameters: " + namedParams + "\n" + "Unnamed Parameters: " + unnamedParams + "\n"
            + "Raw Parameters: " + rawParams;

    TextArea ta = new TextArea(paramStr);
    Group root = new Group(ta);
    stage.setScene(new Scene(root));
    stage.setTitle("");
    stage.show();//from  ww w.j av a2 s .c  o  m
}

From source file:io.bitsquare.app.BitsquareApp.java

private void showFPSWindow() {
    Label label = new Label();
    EventStreams.animationTicks().latestN(100).map(ticks -> {
        int n = ticks.size() - 1;
        return n * 1_000_000_000.0 / (ticks.get(n) - ticks.get(0));
    }).map(d -> String.format("FPS: %.3f", d)).feedTo(label.textProperty());

    Pane root = new StackPane();
    root.getChildren().add(label);//www. ja  va 2  s  .  c om
    Stage stage = new Stage();
    stage.setScene(new Scene(root));
    stage.setTitle("FPS");
    stage.initModality(Modality.NONE);
    stage.initStyle(StageStyle.UTILITY);
    stage.initOwner(scene.getWindow());
    stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10);
    stage.setY(primaryStage.getY());
    stage.setWidth(200);
    stage.setHeight(100);
    stage.show();
}