Ejemplo n.º 1
0
  private void inicializaComponentes() {
    GridPane inputs = buildInputs();
    VBox image = getImage();

    HBox vbox = new HBox();
    vbox.getChildren().addAll(image, inputs);
    Scene scene = new Scene(new Group(vbox));
    scene.getStylesheets().add("style.css");
    this.setScene(scene);

    // fecha a tela com ESC
    scene
        .getAccelerators()
        .put(
            new KeyCodeCombination(KeyCode.ESCAPE, KeyCombination.SHORTCUT_ANY),
            new Runnable() {
              @Override
              public void run() {
                Platform.runLater(
                    new Runnable() {
                      @Override
                      public void run() {
                        hide();
                      }
                    });
              }
            });
  }
Ejemplo n.º 2
0
  private Scene initScene() {
    MainPane mainPane = ApplicationContextHolder.getContext().getBean(MainPane.class);

    NotificationsContainer notifications =
        ApplicationContextHolder.getContext().getBean(NotificationsContainer.class);
    StackPane main = new StackPane();
    StackPane.setAlignment(notifications, Pos.BOTTOM_RIGHT);
    StackPane.setAlignment(mainPane, Pos.TOP_LEFT);
    main.getChildren().addAll(mainPane, notifications);

    StylesConfig styles = ApplicationContextHolder.getContext().getBean(StylesConfig.class);

    Scene mainScene = new Scene(main);
    mainScene.getStylesheets().addAll(styles.styles());
    mainScene
        .getAccelerators()
        .put(
            new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN),
            () -> eventStudio().broadcast(new ShowStageRequest(), "LogStage"));
    return mainScene;
  }