Example usage for javafx.scene Scene getAccelerators

List of usage examples for javafx.scene Scene getAccelerators

Introduction

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

Prototype

public ObservableMap<KeyCombination, Runnable> getAccelerators() 

Source Link

Document

Gets the list of accelerators for this Scene .

Usage

From source file:org.pdfsam.App.java

@Override
public void start(Stage primaryStage) {
    STOPWATCH.start();/*from w  ww . j  av a2  s  .c om*/
    LOG.info(DefaultI18nContext.getInstance().i18n("Starting pdfsam"));
    List<String> styles = (List<String>) ApplicationContextHolder.getContext().getBean("styles");
    Map<String, Image> logos = ApplicationContextHolder.getContext().getBeansOfType(Image.class);
    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);

    Scene scene = new Scene(main);
    scene.getStylesheets().addAll(styles);
    primaryStage.setScene(scene);
    primaryStage.getIcons().addAll(logos.values());
    primaryStage.setTitle(ApplicationContextHolder.getContext().getBean("appName", String.class));
    scene.getAccelerators().put(new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN),
            () -> eventStudio().broadcast(new ShowStageRequest(), "LogStage"));
    primaryStage.show();
    eventStudio().add(new TitleController(primaryStage));
    requestCheckForUpdateIfNecessary();
    eventStudio().addAnnotatedListeners(this);
    STOPWATCH.stop();
    LOG.info(DefaultI18nContext.getInstance().i18n("Started in {0}",
            DurationFormatUtils.formatDurationWords(STOPWATCH.getTime(), true, true)));
}