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) throws IOException {
    URL fxmlUrl = this.getClass().getClassLoader().getResource("resources/fxml/sayhello.fxml");

    // Load the FXML document
    VBox root = FXMLLoader.<VBox>load(fxmlUrl);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Hello FXML");
    stage.show();//from w w  w.ja v a 2s .  c o  m
}

From source file:Main.java

private void createClipList(GridPane grid) {
    final VBox vbox = new VBox(30);
    vbox.setAlignment(Pos.TOP_CENTER);/* ww  w.j  av  a 2 s  .  c o  m*/

    final Label clipLabel = new Label("Code Monkey To-Do List:");
    clipLabel.setId("clipLabel");

    final Button getUpButton = new Button("Get Up, Get Coffee");
    getUpButton.setPrefWidth(300);
    getUpButton.setOnAction(createPlayHandler(coffeeClip));

    final Button goToJobButton = new Button("Go to Job");
    goToJobButton.setPrefWidth(300);
    goToJobButton.setOnAction(createPlayHandler(jobClip));

    final Button meetingButton = new Button("Have Boring Meeting");
    meetingButton.setPrefWidth(300);
    meetingButton.setOnAction(createPlayHandler(meetingClip));

    final Hyperlink link = new Hyperlink("About Code Monkey...");
    link.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            WebView wv = new WebView();
            wv.getEngine().load("http://www.jonathancoulton.com/2006/04/14/" + "thing-a-week-29-code-monkey/");

            Scene scene = new Scene(wv, 720, 480);

            Stage stage = new Stage();
            stage.setTitle("Code Monkey");
            stage.setScene(scene);
            stage.show();
        }
    });

    vbox.getChildren().addAll(clipLabel, getUpButton, goToJobButton, meetingButton, link);

    GridPane.setHalignment(vbox, HPos.CENTER);
    GridPane.setHgrow(vbox, Priority.ALWAYS);
    GridPane.setVgrow(vbox, Priority.ALWAYS);
    grid.add(vbox, 0, 0, GridPane.REMAINING, 1);
}

From source file:Main.java

@Override
public void start(Stage stage) {
    ChoiceBox choiceBoxRef = ChoiceBoxBuilder.create().items(cursors).build();

    VBox box = new VBox();
    box.getChildren().add(choiceBoxRef);
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/*from   ww  w  .j  av  a  2s.  co  m*/
    stage.setScene(scene);
    stage.show();
    scene.cursorProperty().bind(choiceBoxRef.getSelectionModel().selectedItemProperty());

}

From source file:Main.java

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

    final Circle circ = new Circle(40, Color.RED);

    System.out.println(circ.getRadius());

    final Group root = new Group(circ);
    final Scene scene = new Scene(root, 400, 300);

    primaryStage.setScene(scene);
    primaryStage.show();/*from w w w  .  j  ava2 s .co  m*/
}

From source file:Main.java

@Override
public void start(Stage stage) {
    ChoiceBox<String> choiceBox = new ChoiceBox<String>(cursors);

    choiceBox.hide();/*from   w ww.j a va 2s  .c  o m*/
    VBox box = new VBox();
    box.getChildren().add(choiceBox);
    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 primaryStage) {
    primaryStage.setTitle("Title");

    final Circle circ = new Circle(40, Color.RED);

    System.out.println(circ.getCenterY());

    final Group root = new Group(circ);
    final Scene scene = new Scene(root, 400, 300);

    primaryStage.setScene(scene);
    primaryStage.show();/*from w w w  .j  a va2s  .  co m*/
}

From source file:Main.java

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

    final Circle circ = new Circle(40, Color.RED);

    System.out.println(circ.getCenterX());

    final Group root = new Group(circ);
    final Scene scene = new Scene(root, 400, 300);

    primaryStage.setScene(scene);
    primaryStage.show();/*from ww  w .ja  v  a2 s .  c  o  m*/
}

From source file:Main.java

@Override
public void start(Stage stage) {
    ChoiceBox<String> choiceBox = new ChoiceBox<String>();
    choiceBox.setItems(cursors);//from   ww  w .j  ava 2 s .  c  o m

    VBox box = new VBox();
    box.getChildren().add(choiceBox);
    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) {
    Button okBtn = new Button("OK");
    Button cancelBtn = new Button("Cancel");

    cancelBtn.setPrefWidth(100);// w w w  .  ja v a  2 s . c o m

    VBox root = new VBox();
    root.getChildren().addAll(okBtn, cancelBtn);

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Overriding Node Sizes");
    stage.show();

}

From source file:Main.java

@Override
public void start(Stage stage) {
    ChoiceBox choiceBox = new ChoiceBox(cursors);

    System.out.println(choiceBox.getItems());
    VBox box = new VBox();
    box.getChildren().add(choiceBox);//from  w  ww .j a v  a  2s .c  om
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
}