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:dtv.DTVEdit.java

@Override
public void start(Stage primaryStage) throws Exception {

    notifyPreloader(new Preloader.StateChangeNotification(Preloader.StateChangeNotification.Type.BEFORE_START));

    primaryStage.setTitle("DTV Edit");
    primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/app_icon.png")));

    AnchorPane mainView = (AnchorPane) load("/dtv/view/FXMLMain.fxml");

    // Show the scene containing the root layout.
    Scene scene = new Scene(mainView);
    primaryStage.setScene(scene);
    primaryStage.setResizable(false);//from  ww w . ja  v a 2s.c om
    primaryStage.setOnCloseRequest(e -> Platform.exit());
    // set scss style
    /*
    String css = getClass().getResource("/myStyle.css").toExternalForm();
    scene.getStylesheets().clear();
    scene.getStylesheets().add(css);
    */
    primaryStage.show();
}

From source file:Main.java

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

    TilePane tile = new TilePane();

    tile.setHgap(8);/*from   w w w .  j a  v  a2s.  c  om*/
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("CheckBox"));
    }
    tile.setAlignment(Pos.BASELINE_CENTER);

    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {

    Button openURLButton = new Button("Go!");
    openURLButton.setOnAction(e -> {/*from  ww w  .  j  a  va2  s  .co  m*/
        HostServices host = this.getHostServices();

        System.out.println("CodeBase:" + host.getCodeBase());

        System.out.println("DocumentBase:" + host.getDocumentBase());

        System.out.println("Environment:" + host.getWebContext());

        System.out.println("Splash Image URI" + host.resolveURI(host.getDocumentBase(), "splash.jpg"));
    });

    Scene scene = new Scene(openURLButton);
    stage.setScene(scene);
    stage.setTitle("Knowing the Host");
    stage.show();
}

From source file:Main.java

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

    TilePane tile = new TilePane();
    tile.setHgap(8);/*  w  ww  . j av  a  2s  .c  om*/
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("CheckBox"));
    }
    System.out.println(tile.prefColumnsProperty());
    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    Group root = (Group) scene.getRoot();
    root.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(), 450, 250);

    TilePane tile = new TilePane();
    tile.setHgap(8);//from w ww  .j  av  a 2s  .  c o  m
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("CheckBox"));
    }
    System.out.println(tile.orientationProperty());
    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    final GridPane grid = new GridPane();
    grid.setPadding(new Insets(10));
    grid.setHgap(10);/*w  w  w.ja  v a  2  s.co  m*/
    grid.setVgap(5);

    createControls(grid);
    createClipList(grid);

    final Scene scene = new Scene(grid, 640, 380);
    scene.getStylesheets().add(getClass().getResource("media.css").toString());

    primaryStage.setTitle("AudioClip Example");
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

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

    TilePane tile = new TilePane();

    tile.setHgap(8);/*from  ww  w. j a va 2  s.c om*/
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("CheckBox"));
    }
    System.out.println(tile.vgapProperty());

    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    Group root = (Group) scene.getRoot();
    root.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(), 450, 250);

    TilePane tile = new TilePane();
    tile.setHgap(8);//from   w  w w.j  a  v  a  2s  .c o  m
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("CheckBox"));
    }
    System.out.println(tile.prefTileWidthProperty());
    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    Group root = (Group) scene.getRoot();
    root.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(), 450, 250);

    TilePane tile = new TilePane();

    tile.setHgap(8);/*ww  w.  j ava 2  s  . c  om*/
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("CheckBox"));
    }

    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    TilePane.setMargin(hbox, Insets.EMPTY);

    Group root = (Group) scene.getRoot();
    root.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(), 450, 250);

    TilePane tile = new TilePane();
    tile.setHgap(8);//from   ww w  .  j  a va 2s.  com
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("CheckBox"));
    }
    System.out.println(tile.prefTileHeightProperty());
    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}