Example usage for javafx.scene.input KeyCode D

List of usage examples for javafx.scene.input KeyCode D

Introduction

In this page you can find the example usage for javafx.scene.input KeyCode D.

Prototype

KeyCode D

To view the source code for javafx.scene.input KeyCode D.

Click Source Link

Document

Constant for the D key.

Usage

From source file:Main.java

@Override
public void start(final Stage stage) {
    final Keyboard keyboard = new Keyboard(new Key(KeyCode.A), new Key(KeyCode.S), new Key(KeyCode.D),
            new Key(KeyCode.F));

    final Scene scene = new Scene(new Group(keyboard.createNode()));
    stage.setScene(scene);// ww w .  j a va  2s . c  o  m
    stage.setTitle("Keyboard Example");
    stage.show();
}

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

@Override
public void start(Stage stage) throws IOException {
    BitsquareApp.primaryStage = stage;/*from  ww w. ja  v a2 s  .c o  m*/

    String logPath = Paths.get(env.getProperty(AppOptionKeys.APP_DATA_DIR_KEY), "bitsquare").toString();
    Log.setup(logPath);
    log.info("Log files under: " + logPath);
    Version.printVersion();
    Utilities.printSysInfo();
    Log.setLevel(Level.toLevel(env.getRequiredProperty(CommonOptionKeys.LOG_LEVEL_KEY)));

    UserThread.setExecutor(Platform::runLater);
    UserThread.setTimerClass(UITimer.class);

    shutDownHandler = this::stop;

    // setup UncaughtExceptionHandler
    Thread.UncaughtExceptionHandler handler = (thread, throwable) -> {
        // Might come from another thread 
        if (throwable.getCause() != null && throwable.getCause().getCause() != null
                && throwable.getCause().getCause() instanceof BlockStoreException) {
            log.error(throwable.getMessage());
        } else if (throwable instanceof ClassCastException
                && "sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData"
                        .equals(throwable.getMessage())) {
            log.warn(throwable.getMessage());
        } else {
            log.error("Uncaught Exception from thread " + Thread.currentThread().getName());
            log.error("throwableMessage= " + throwable.getMessage());
            log.error("throwableClass= " + throwable.getClass());
            log.error("Stack trace:\n" + ExceptionUtils.getStackTrace(throwable));
            throwable.printStackTrace();
            UserThread.execute(() -> showErrorPopup(throwable, false));
        }
    };
    Thread.setDefaultUncaughtExceptionHandler(handler);
    Thread.currentThread().setUncaughtExceptionHandler(handler);

    try {
        Utilities.checkCryptoPolicySetup();
    } catch (NoSuchAlgorithmException | LimitedKeyStrengthException e) {
        e.printStackTrace();
        UserThread.execute(() -> showErrorPopup(e, true));
    }

    Security.addProvider(new BouncyCastleProvider());

    try {
        // Guice
        bitsquareAppModule = new BitsquareAppModule(env, primaryStage);
        injector = Guice.createInjector(bitsquareAppModule);
        injector.getInstance(InjectorViewFactory.class).setInjector(injector);

        Version.setBtcNetworkId(injector.getInstance(BitsquareEnvironment.class).getBitcoinNetwork().ordinal());

        if (Utilities.isLinux())
            System.setProperty("prism.lcdtext", "false");

        Storage.setDatabaseCorruptionHandler((String fileName) -> {
            corruptedDatabaseFiles.add(fileName);
            if (mainView != null)
                mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
        });

        // load the main view and create the main scene
        CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class);
        mainView = (MainView) viewLoader.load(MainView.class);
        mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);

        /* Storage.setDatabaseCorruptionHandler((String fileName) -> {
        corruptedDatabaseFiles.add(fileName);
        if (mainView != null)
            mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
         });*/

        scene = new Scene(mainView.getRoot(), 1200, 700); //740

        Font.loadFont(getClass().getResource("/fonts/Verdana.ttf").toExternalForm(), 13);
        Font.loadFont(getClass().getResource("/fonts/VerdanaBold.ttf").toExternalForm(), 13);
        Font.loadFont(getClass().getResource("/fonts/VerdanaItalic.ttf").toExternalForm(), 13);
        Font.loadFont(getClass().getResource("/fonts/VerdanaBoldItalic.ttf").toExternalForm(), 13);
        scene.getStylesheets().setAll("/io/bitsquare/gui/bitsquare.css", "/io/bitsquare/gui/images.css",
                "/io/bitsquare/gui/CandleStickChart.css");

        // configure the system tray
        SystemTray.create(primaryStage, shutDownHandler);

        primaryStage.setOnCloseRequest(event -> {
            event.consume();
            stop();
        });
        scene.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent -> {
            if (new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN).match(keyEvent)
                    || new KeyCodeCombination(KeyCode.W, KeyCombination.CONTROL_DOWN).match(keyEvent)) {
                stop();
            } else if (new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN).match(keyEvent)
                    || new KeyCodeCombination(KeyCode.Q, KeyCombination.CONTROL_DOWN).match(keyEvent)) {
                stop();
            } else if (new KeyCodeCombination(KeyCode.E, KeyCombination.SHORTCUT_DOWN).match(keyEvent)
                    || new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN).match(keyEvent)) {
                showEmptyWalletPopup();
            } else if (new KeyCodeCombination(KeyCode.M, KeyCombination.ALT_DOWN).match(keyEvent)) {
                showSendAlertMessagePopup();
            } else if (new KeyCodeCombination(KeyCode.F, KeyCombination.ALT_DOWN).match(keyEvent)) {
                showFilterPopup();
            } else if (new KeyCodeCombination(KeyCode.F, KeyCombination.ALT_DOWN).match(keyEvent)) {
                showFPSWindow();
            } else if (new KeyCodeCombination(KeyCode.J, KeyCombination.ALT_DOWN).match(keyEvent)) {
                WalletService walletService = injector.getInstance(WalletService.class);
                if (walletService.getWallet() != null)
                    new ShowWalletDataWindow(walletService).information("Wallet raw data").show();
                else
                    new Popup<>().warning("The wallet is not initialized yet").show();
            } else if (new KeyCodeCombination(KeyCode.G, KeyCombination.ALT_DOWN).match(keyEvent)) {
                TradeWalletService tradeWalletService = injector.getInstance(TradeWalletService.class);
                WalletService walletService = injector.getInstance(WalletService.class);
                if (walletService.getWallet() != null)
                    new SpendFromDepositTxWindow(tradeWalletService).information("Emergency wallet tool")
                            .show();
                else
                    new Popup<>().warning("The wallet is not initialized yet").show();
            } else if (DevFlags.DEV_MODE
                    && new KeyCodeCombination(KeyCode.D, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) {
                showDebugWindow();
            }
        });

        // configure the primary stage
        primaryStage.setTitle(env.getRequiredProperty(APP_NAME_KEY));
        primaryStage.setScene(scene);
        primaryStage.setMinWidth(1000); // 1190
        primaryStage.setMinHeight(620);

        // on windows the title icon is also used as task bar icon in a larger size
        // on Linux no title icon is supported but also a large task bar icon is derived from that title icon
        String iconPath;
        if (Utilities.isOSX())
            iconPath = ImageUtil.isRetina() ? "/images/window_icon@2x.png" : "/images/window_icon.png";
        else if (Utilities.isWindows())
            iconPath = "/images/task_bar_icon_windows.png";
        else
            iconPath = "/images/task_bar_icon_linux.png";

        primaryStage.getIcons().add(new Image(getClass().getResourceAsStream(iconPath)));

        // make the UI visible
        primaryStage.show();

        if (!Utilities.isCorrectOSArchitecture()) {
            String osArchitecture = Utilities.getOSArchitecture();
            // We don't force a shutdown as the osArchitecture might in strange cases return a wrong value.
            // Needs at least more testing on different machines...
            new Popup<>()
                    .warning("You probably have the wrong Bitsquare version for this computer.\n"
                            + "Your computer's architecture is: " + osArchitecture + ".\n"
                            + "The Bitsquare binary you installed is: " + Utilities.getJVMArchitecture() + ".\n"
                            + "Please shut down and re-install the correct version (" + osArchitecture + ").")
                    .show();
        }

        UserThread.runPeriodically(() -> Profiler.printSystemLoad(log), LOG_MEMORY_PERIOD_MIN,
                TimeUnit.MINUTES);

    } catch (Throwable throwable)

    {
        showErrorPopup(throwable, false);
    }

}

From source file:be.makercafe.apps.makerbench.Main.java

/**
 * Creates the menubar//from w ww . ja  v  a2s . c o  m
 *
 * @return
 */
private MenuBar createMenuBar() {
    MenuBar bar = new MenuBar();
    Menu projectMenu = new Menu("Project");
    MenuItem openProject = new MenuItem("Open...");
    openProject.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            directoryChooser.setTitle("Please choose a project folder");
            File file = directoryChooser.showDialog(stage);

            viewer.setRoot(setRootFolder(file));

        }
    });
    Menu newProject = new Menu("New");

    MenuItem newFolder = new MenuItem("Folder...");
    newFolder.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            TextInputDialog dialog = new TextInputDialog("my_project_folder");
            dialog.setTitle("New folder");
            dialog.setHeaderText("Create a new folder");
            dialog.setContentText("Folder name:");
            Optional<String> result = dialog.showAndWait();
            if (result.isPresent()) {
                String homeDir = System.getProperty("user.home");

                System.out.println("Folder name: " + result.get());
                System.out.println("User home: " + homeDir);
            }
        }
    });
    newProject.getItems().add(newFolder);

    MenuItem importProject = new MenuItem("Import");
    importProject.setAccelerator(new KeyCodeCombination(KeyCode.I, KeyCombination.CONTROL_DOWN));
    importProject.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Import");

        }
    });
    MenuItem deleteProject = new MenuItem("Delete");
    deleteProject.setAccelerator(new KeyCodeCombination(KeyCode.D, KeyCombination.CONTROL_DOWN));
    deleteProject.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Delete");

        }
    });
    projectMenu.getItems().addAll(openProject, newProject, importProject, deleteProject);

    Menu helpMenu = new Menu("Help");

    MenuItem aboutItem = new MenuItem("About");
    aboutItem.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            Alert alert = new Alert(AlertType.INFORMATION);
            alert.setTitle("Information Dialog");
            alert.setHeaderText("About makerbench");
            alert.setContentText(
                    "Makerbench is an open source IDE for designing and manufacturing objects and code.\nWritten by Luc De pauw\n\nUses opensource libraries from the next projects:\n-RichtextFX by Tomas Mikula\n-JCSG by Michael Hoffer\n-ControlsFX by FXexperience.com");
            alert.showAndWait();
        }
    });

    helpMenu.getItems().add(aboutItem);
    bar.getMenus().addAll(projectMenu, helpMenu);
    return bar;
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param vbRacine panel d'installation du menu
 * @throws Exception Exceptions//from w ww  . j a  va  2 s  .c o m
 */
private static void creeMenu(VBox vbRacine) throws Exception {
    VBox vbMonPanneau = new VBox();

    vbMonPanneau.setPrefHeight(80);
    vbMonPanneau.setPrefWidth(3000);
    mbarPrincipal.setMinHeight(29);
    mbarPrincipal.setPrefHeight(29);
    mbarPrincipal.setMaxHeight(29);
    mbarPrincipal.setPrefWidth(3000);
    if (isMac()) {
        mbarPrincipal.setUseSystemMenuBar(true);
    }
    /* 
     Menu projets
     */
    Menu mnuProjet = new Menu(rbLocalisation.getString("projets"));

    mbarPrincipal.getMenus().add(mnuProjet);
    mniNouveauProjet = new MenuItem(rbLocalisation.getString("nouveauProjet"));
    mniNouveauProjet.setAccelerator(new KeyCodeCombination(KeyCode.N, KeyCombination.SHORTCUT_DOWN));
    mnuProjet.getItems().add(mniNouveauProjet);
    mniChargeProjet = new MenuItem(rbLocalisation.getString("ouvrirProjet"));
    mniChargeProjet.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN));

    mnuProjet.getItems().add(mniChargeProjet);
    mniSauveProjet = new MenuItem(rbLocalisation.getString("sauverProjet"));
    mniSauveProjet.setDisable(true);
    mniSauveProjet.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN));
    mnuProjet.getItems().add(mniSauveProjet);
    mniSauveSousProjet = new MenuItem(rbLocalisation.getString("sauverProjetSous"));
    mniSauveSousProjet.setDisable(true);
    mniSauveSousProjet.setAccelerator(
            new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN, KeyCodeCombination.SHIFT_DOWN));
    mnuProjet.getItems().add(mniSauveSousProjet);
    mnuDerniersProjets = new Menu(rbLocalisation.getString("derniersProjets"));
    mnuProjet.getItems().add(mnuDerniersProjets);
    fileHistoFichiers = new File(fileRepertConfig.getAbsolutePath() + File.separator + "derniersprojets.cfg");
    nombreHistoFichiers = 0;
    if (fileHistoFichiers.exists()) {
        try (BufferedReader brHistoFichiers = new BufferedReader(
                new InputStreamReader(new FileInputStream(fileHistoFichiers), "UTF-8"))) {
            while ((strTexteHisto = brHistoFichiers.readLine()) != null) {
                MenuItem menuDerniersFichiers = new MenuItem(strTexteHisto);
                mnuDerniersProjets.getItems().add(menuDerniersFichiers);
                strHistoFichiers[nombreHistoFichiers] = strTexteHisto;
                nombreHistoFichiers++;
                menuDerniersFichiers.setOnAction((e) -> {
                    MenuItem mniSousMenu = (MenuItem) e.getSource();
                    try {
                        try {
                            projetChargeNom(mniSousMenu.getText());

                        } catch (InterruptedException ex) {
                            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
                        }

                    } catch (IOException ex) {
                        Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
                    }
                });

            }
        }
    }

    SeparatorMenuItem sepMenu1 = new SeparatorMenuItem();
    mnuProjet.getItems().add(sepMenu1);
    mniFermerProjet = new MenuItem(rbLocalisation.getString("quitterApplication"));
    mniFermerProjet.setAccelerator(new KeyCodeCombination(KeyCode.A, KeyCombination.SHORTCUT_DOWN));
    mnuProjet.getItems().add(mniFermerProjet);
    /*
     Menu affichage
     */
    Menu mnuAffichage = new Menu(rbLocalisation.getString("affichage"));
    mbarPrincipal.getMenus().add(mnuAffichage);
    mniAffichageVisite = new MenuItem(rbLocalisation.getString("main.creationVisite"));
    mniAffichageVisite.setAccelerator(new KeyCodeCombination(KeyCode.DIGIT1, KeyCombination.SHORTCUT_DOWN));
    mnuAffichage.getItems().add(mniAffichageVisite);
    mniAffichageInterface = new MenuItem(rbLocalisation.getString("main.creationInterface"));
    mniAffichageInterface.setAccelerator(new KeyCodeCombination(KeyCode.DIGIT2, KeyCombination.SHORTCUT_DOWN));
    mnuAffichage.getItems().add(mniAffichageInterface);
    setMniAffichagePlan(new MenuItem(rbLocalisation.getString("main.tabPlan")));
    getMniAffichagePlan().setAccelerator(new KeyCodeCombination(KeyCode.DIGIT3, KeyCombination.SHORTCUT_DOWN));
    getMniAffichagePlan().setDisable(true);
    mnuAffichage.getItems().add(getMniAffichagePlan());
    mniOutilsLoupe = new MenuItem(rbLocalisation.getString("main.loupe"));
    mniOutilsLoupe.setAccelerator(new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN));
    mnuAffichage.getItems().add(mniOutilsLoupe);

    SeparatorMenuItem sep3 = new SeparatorMenuItem();
    mnuAffichage.getItems().add(sep3);
    mniConfigTransformation = new MenuItem(rbLocalisation.getString("affichageConfiguration"));
    mnuAffichage.getItems().add(mniConfigTransformation);

    /*
     Menu panoramiques
     */
    mnuPanoramique = new Menu(rbLocalisation.getString("panoramiques"));
    mnuPanoramique.setDisable(true);
    mbarPrincipal.getMenus().add(mnuPanoramique);
    mniAjouterPano = new MenuItem(rbLocalisation.getString("ajouterPanoramiques"));
    mniAjouterPano.setAccelerator(new KeyCodeCombination(KeyCode.A, KeyCombination.SHORTCUT_DOWN));
    mnuPanoramique.getItems().add(mniAjouterPano);
    setMniAjouterPlan(new MenuItem(rbLocalisation.getString("ajouterPlan")));
    getMniAjouterPlan().setAccelerator(new KeyCodeCombination(KeyCode.P, KeyCombination.SHORTCUT_DOWN));
    mnuPanoramique.getItems().add(getMniAjouterPlan());
    getMniAjouterPlan().setDisable(true);
    SeparatorMenuItem sep2 = new SeparatorMenuItem();
    mnuPanoramique.getItems().add(sep2);
    mniVisiteGenere = new MenuItem(rbLocalisation.getString("genererVisite"));
    mniVisiteGenere.setDisable(true);
    mniVisiteGenere.setAccelerator(new KeyCodeCombination(KeyCode.V, KeyCombination.SHORTCUT_DOWN));
    mnuPanoramique.getItems().add(mniVisiteGenere);
    /*
     Menu Modles 
     */
    mnuModeles = new Menu(rbLocalisation.getString("menuModele"));
    mbarPrincipal.getMenus().add(mnuModeles);

    mniChargerModele = new MenuItem(rbLocalisation.getString("modeleCharger"));
    mnuModeles.getItems().add(mniChargerModele);

    mniSauverModele = new MenuItem(rbLocalisation.getString("modeleSauver"));
    mnuModeles.getItems().add(mniSauverModele);

    /*
     Menu transformations 
     */
    mnuTransformation = new Menu(rbLocalisation.getString("outils"));
    mbarPrincipal.getMenus().add(mnuTransformation);
    mniEqui2CubeTransformation = new MenuItem(rbLocalisation.getString("outilsEqui2Cube"));
    mnuTransformation.getItems().add(mniEqui2CubeTransformation);
    mniCube2EquiTransformation = new MenuItem(rbLocalisation.getString("outilsCube2Equi"));
    mnuTransformation.getItems().add(mniCube2EquiTransformation);
    SeparatorMenuItem sep6 = new SeparatorMenuItem();
    mnuTransformation.getItems().add(sep6);
    mniOutilsBarre = new MenuItem(rbLocalisation.getString("outilsBarre"));
    mniOutilsBarre.setAccelerator(new KeyCodeCombination(KeyCode.B, KeyCombination.SHORTCUT_DOWN));
    mnuTransformation.getItems().add(mniOutilsBarre);
    mniOutilsDiaporama = new MenuItem(rbLocalisation.getString("outilsDiaporama"));
    mniOutilsDiaporama.setAccelerator(new KeyCodeCombination(KeyCode.D, KeyCombination.SHORTCUT_DOWN));
    mnuTransformation.getItems().add(mniOutilsDiaporama);

    /*
     Menu Aide
     */
    Menu mnuAide = new Menu(rbLocalisation.getString("aide"));
    mbarPrincipal.getMenus().add(mnuAide);
    mniAide = new MenuItem(rbLocalisation.getString("aideAide"));
    mniAide.setAccelerator(new KeyCodeCombination(KeyCode.H, KeyCombination.SHORTCUT_DOWN));
    mnuAide.getItems().add(mniAide);
    SeparatorMenuItem sep4 = new SeparatorMenuItem();
    mnuAide.getItems().add(sep4);
    mniAPropos = new MenuItem(rbLocalisation.getString("aideAPropos"));
    mnuAide.getItems().add(mniAPropos);
    //
    //        }
    //
    /*
     barre de boutons 
     */
    hbBarreBouton = new HBox();
    hbBarreBouton.getStyleClass().add("menuBarreOutils1");

    hbBarreBouton.setPrefHeight(50);
    hbBarreBouton.setMinHeight(50);
    hbBarreBouton.setPrefWidth(3000);
    /*
     Bouton nouveau Projet
     */
    ScrollPane spBtnNouvprojet = new ScrollPane();
    spBtnNouvprojet.getStyleClass().add("menuBarreOutils");
    spBtnNouvprojet.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spBtnNouvprojet.setPrefHeight(35);
    spBtnNouvprojet.setMaxHeight(35);
    spBtnNouvprojet.setPadding(new Insets(2));
    spBtnNouvprojet.setPrefWidth(35);

    HBox.setMargin(spBtnNouvprojet, new Insets(5, 15, 0, 15));
    ivNouveauProjet = new ImageView(
            new Image("file:" + getStrRepertAppli() + File.separator + "images/nouveauProjet.png"));
    spBtnNouvprojet.setContent(ivNouveauProjet);
    Tooltip tltpNouveauProjet = new Tooltip(rbLocalisation.getString("nouveauProjet"));
    tltpNouveauProjet.setStyle(getStrTooltipStyle());
    spBtnNouvprojet.setTooltip(tltpNouveauProjet);
    hbBarreBouton.getChildren().add(spBtnNouvprojet);
    /*
     Bouton ouvrir Projet
     */
    ScrollPane spBtnOuvrirProjet = new ScrollPane();
    spBtnOuvrirProjet.getStyleClass().add("menuBarreOutils");
    spBtnOuvrirProjet.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spBtnOuvrirProjet.setPrefHeight(35);
    spBtnOuvrirProjet.setMaxHeight(35);
    spBtnOuvrirProjet.setPadding(new Insets(2));
    spBtnOuvrirProjet.setPrefWidth(35);

    HBox.setMargin(spBtnOuvrirProjet, new Insets(5, 15, 0, 0));
    ivChargeProjet = new ImageView(
            new Image("file:" + getStrRepertAppli() + File.separator + "images/ouvrirProjet.png"));
    spBtnOuvrirProjet.setContent(ivChargeProjet);
    Tooltip tltpOuvrirProjet = new Tooltip(rbLocalisation.getString("ouvrirProjet"));
    tltpOuvrirProjet.setStyle(getStrTooltipStyle());
    spBtnOuvrirProjet.setTooltip(tltpOuvrirProjet);
    hbBarreBouton.getChildren().add(spBtnOuvrirProjet);

    /*
     Bouton sauve Projet
     */
    ScrollPane spBtnSauveProjet = new ScrollPane();
    spBtnSauveProjet.getStyleClass().add("menuBarreOutils");
    spBtnSauveProjet.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spBtnSauveProjet.setPrefHeight(35);
    spBtnSauveProjet.setMaxHeight(35);
    spBtnSauveProjet.setPadding(new Insets(2));
    spBtnSauveProjet.setPrefWidth(35);

    HBox.setMargin(spBtnSauveProjet, new Insets(5, 15, 0, 0));
    ivSauveProjet = new ImageView(
            new Image("file:" + getStrRepertAppli() + File.separator + "images/sauveProjet.png"));
    spBtnSauveProjet.setContent(ivSauveProjet);
    Tooltip tltpSauverProjet = new Tooltip(rbLocalisation.getString("sauverProjet"));
    tltpSauverProjet.setStyle(getStrTooltipStyle());
    spBtnSauveProjet.setTooltip(tltpSauverProjet);
    hbBarreBouton.getChildren().add(spBtnSauveProjet);
    Separator sepImages = new Separator(Orientation.VERTICAL);
    sepImages.prefHeight(200);
    hbBarreBouton.getChildren().add(sepImages);
    ivSauveProjet.setDisable(true);
    ivSauveProjet.setOpacity(0.3);
    /*
     Bouton Ajoute Panoramique
     */
    ScrollPane spBtnAjoutePano = new ScrollPane();
    spBtnAjoutePano.getStyleClass().add("menuBarreOutils");
    spBtnAjoutePano.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spBtnAjoutePano.setPrefHeight(35);
    spBtnAjoutePano.setMaxHeight(35);
    spBtnAjoutePano.setPadding(new Insets(2));
    spBtnAjoutePano.setPrefWidth(35);

    HBox.setMargin(spBtnAjoutePano, new Insets(5, 15, 0, 15));
    ivAjouterPano = new ImageView(
            new Image("file:" + getStrRepertAppli() + File.separator + "images/ajoutePanoramique.png"));
    spBtnAjoutePano.setContent(ivAjouterPano);
    Tooltip tltpAjouterPano = new Tooltip(rbLocalisation.getString("ajouterPanoramiques"));
    tltpAjouterPano.setStyle(getStrTooltipStyle());
    spBtnAjoutePano.setTooltip(tltpAjouterPano);
    hbBarreBouton.getChildren().add(spBtnAjoutePano);
    ivAjouterPano.setDisable(true);
    ivAjouterPano.setOpacity(0.3);

    /*
     Bouton Ajoute Panoramique
     */
    ScrollPane spBtnAjoutePlan = new ScrollPane();
    spBtnAjoutePlan.getStyleClass().add("menuBarreOutils");
    spBtnAjoutePlan.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spBtnAjoutePlan.setPrefHeight(35);
    spBtnAjoutePlan.setMaxHeight(35);
    spBtnAjoutePlan.setPadding(new Insets(2));
    spBtnAjoutePlan.setPrefWidth(35);

    HBox.setMargin(spBtnAjoutePlan, new Insets(5, 15, 0, 15));
    setIvAjouterPlan(
            new ImageView(new Image("file:" + getStrRepertAppli() + File.separator + "images/ajoutePlan.png")));
    spBtnAjoutePlan.setContent(getIvAjouterPlan());
    Tooltip tltpAjouterPlan = new Tooltip(rbLocalisation.getString("ajouterPlan"));
    tltpAjouterPlan.setStyle(getStrTooltipStyle());
    spBtnAjoutePlan.setTooltip(tltpAjouterPlan);
    hbBarreBouton.getChildren().add(spBtnAjoutePlan);
    getIvAjouterPlan().setDisable(true);
    getIvAjouterPlan().setOpacity(0.3);

    /*
     Bouton Gnre
     */
    ScrollPane spBtnGenereVisite = new ScrollPane();
    spBtnGenereVisite.getStyleClass().add("menuBarreOutils");
    spBtnGenereVisite.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spBtnGenereVisite.setPrefHeight(35);
    spBtnGenereVisite.setMaxHeight(35);
    spBtnGenereVisite.setPadding(new Insets(2));
    spBtnGenereVisite.setPrefWidth(70);

    HBox.setMargin(spBtnGenereVisite, new Insets(5, 15, 0, 0));
    ivVisiteGenere = new ImageView(
            new Image("file:" + getStrRepertAppli() + File.separator + "images/genereVisite.png"));
    spBtnGenereVisite.setContent(ivVisiteGenere);
    Tooltip tltpGenererVisite = new Tooltip(rbLocalisation.getString("genererVisite"));
    tltpGenererVisite.setStyle(getStrTooltipStyle());
    spBtnGenereVisite.setTooltip(tltpGenererVisite);
    hbBarreBouton.getChildren().add(spBtnGenereVisite);
    ivVisiteGenere.setDisable(true);
    ivVisiteGenere.setOpacity(0.3);
    Separator sepImages1 = new Separator(Orientation.VERTICAL);
    sepImages1.prefHeight(200);
    hbBarreBouton.getChildren().add(sepImages1);
    /*
     Bouton equi -> faces de  Cube
     */
    ScrollPane spBtnEqui2Cube = new ScrollPane();
    spBtnEqui2Cube.getStyleClass().add("menuBarreOutils");
    spBtnEqui2Cube.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spBtnEqui2Cube.setPrefHeight(35);
    spBtnEqui2Cube.setMaxHeight(35);
    spBtnEqui2Cube.setPadding(new Insets(2));
    spBtnEqui2Cube.setPrefWidth(109);

    HBox.setMargin(spBtnEqui2Cube, new Insets(5, 15, 0, 250));
    ivEqui2Cube = new ImageView(
            new Image("file:" + getStrRepertAppli() + File.separator + "images/equi2cube.png"));
    spBtnEqui2Cube.setContent(ivEqui2Cube);
    Tooltip tltpEqui2Cube = new Tooltip(rbLocalisation.getString("outilsEqui2Cube"));
    tltpEqui2Cube.setStyle(getStrTooltipStyle());
    spBtnEqui2Cube.setTooltip(tltpEqui2Cube);
    hbBarreBouton.getChildren().add(spBtnEqui2Cube);

    /*
     Bouton faces de cube -> equi
     */
    ScrollPane spBtnCube2Equi = new ScrollPane();
    spBtnCube2Equi.getStyleClass().add("menuBarreOutils");
    spBtnCube2Equi.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spBtnCube2Equi.setPrefHeight(35);
    spBtnCube2Equi.setMaxHeight(35);
    spBtnCube2Equi.setPadding(new Insets(2));
    spBtnCube2Equi.setPrefWidth(109);

    HBox.setMargin(spBtnCube2Equi, new Insets(5, 25, 0, 0));
    ivCube2Equi = new ImageView(
            new Image("file:" + getStrRepertAppli() + File.separator + "images/cube2equi.png"));
    spBtnCube2Equi.setContent(ivCube2Equi);
    Tooltip tltpCube2Equi = new Tooltip(rbLocalisation.getString("outilsCube2Equi"));
    tltpCube2Equi.setStyle(getStrTooltipStyle());
    spBtnCube2Equi.setTooltip(tltpCube2Equi);
    hbBarreBouton.getChildren().add(spBtnCube2Equi);
    if (isMac()) {
        mbarPrincipal.setMaxHeight(0);
        hbBarreBouton.setTranslateY(-30);
    }
    vbMonPanneau.getChildren().addAll(mbarPrincipal, hbBarreBouton);
    vbRacine.getChildren().add(vbMonPanneau);
    mniNouveauProjet.setOnAction((e) -> {
        projetsNouveau();
    });
    mniChargeProjet.setOnAction((e) -> {
        try {
            try {
                projetCharge();

            } catch (InterruptedException ex) {
                Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
            }

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    mniSauveProjet.setOnAction((e) -> {
        try {
            projetSauve();

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    mniSauveSousProjet.setOnAction((e) -> {
        try {
            projetSauveSous();

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    mniVisiteGenere.setOnAction((e) -> {
        try {
            genereVisite();

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    mniFermerProjet.setOnAction((e) -> {
        try {
            projetsFermer();

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    mniAjouterPano.setOnAction((e) -> {
        try {
            panoramiquesAjouter();

        } catch (InterruptedException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    getMniAjouterPlan().setOnAction((e) -> {
        planAjouter();
    });
    mniAPropos.setOnAction((e) -> {
        aideapropos();
    });
    mniAide.setOnAction((e) -> {
        AideDialogController.affiche();
    });

    mniChargerModele.setOnAction((e) -> {
        try {
            modeleCharger();

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });

    mniSauverModele.setOnAction((e) -> {
        try {
            modeleSauver();

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });

    mniCube2EquiTransformation.setOnAction((e) -> {
        transformationCube2Equi();
    });

    mniEqui2CubeTransformation.setOnAction((e) -> {
        transformationEqui2Cube();
    });

    mniOutilsBarre.setOnAction((e) -> {
        creerEditerBarre("");
    });
    mniOutilsDiaporama.setOnAction((e) -> {
        creerEditerDiaporama("");
    });
    mniOutilsLoupe.setOnAction((e) -> {
        e.consume();
        setAfficheLoupe(!isAfficheLoupe());
        apLoupe.setVisible(isAfficheLoupe());
        Point p = MouseInfo.getPointerInfo().getLocation();
        if (p.x < getiTailleLoupe() + 80 && p.y < getiTailleLoupe() + 160) {
            apLoupe.setLayoutX(ivImagePanoramique.getFitWidth() - getiTailleLoupe() + 5);
            apLoupe.setLayoutY(35);
            strPositLoupe = "droite";
        } else {
            apLoupe.setLayoutX(35);
            apLoupe.setLayoutY(35);
            strPositLoupe = "gauche";
        }
    });

    mniAffichageVisite.setOnAction((e) -> {
        tpEnvironnement.getSelectionModel().select(0);
    });
    mniAffichageInterface.setOnAction((e) -> {
        tpEnvironnement.getSelectionModel().select(1);
    });
    getMniAffichagePlan().setOnAction((e) -> {
        if (!tabPlan.isDisabled()) {
            tpEnvironnement.getSelectionModel().select(2);
        }
    });

    mniConfigTransformation.setOnAction((e) -> {
        try {
            ConfigDialogController cfg = new ConfigDialogController();
            cfg.afficheFenetre();

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });

    spBtnNouvprojet.setOnMouseClicked((t) -> {
        projetsNouveau();
    });
    spBtnOuvrirProjet.setOnMouseClicked((t) -> {
        try {
            try {
                projetCharge();

            } catch (InterruptedException ex) {
                Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
            }

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    spBtnSauveProjet.setOnMouseClicked((t) -> {
        try {
            projetSauve();

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    spBtnAjoutePano.setOnMouseClicked((t) -> {
        try {
            panoramiquesAjouter();

        } catch (InterruptedException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    spBtnAjoutePlan.setOnMouseClicked((t) -> {
        planAjouter();
    });
    spBtnGenereVisite.setOnMouseClicked((t) -> {
        try {
            genereVisite();

        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    spBtnEqui2Cube.setOnMouseClicked((t) -> {
        transformationEqui2Cube();
    });
    spBtnCube2Equi.setOnMouseClicked((t) -> {
        transformationCube2Equi();
    });

}

From source file:view.FXApplicationController.java

public void keyAction(KeyEvent ke) {
    if (ke.getCode() == KeyCode.RIGHT) {
        goToEpoch(currentEpoch + 1);//from w  ww. j  av a2s.com
    }

    if (ke.getCode() == KeyCode.LEFT) {
        goToEpoch(currentEpoch - 1);
    }

    if (ke.getCode() == KeyCode.H) {
        hypnogramAction();
    }

    if (ke.getCode() == KeyCode.E) {
        showEvaluationWindowAction();
    }

    if (ke.getCode() == KeyCode.L) {
        help1OnAction();
    }

    if (ke.getCode() == KeyCode.K) {
        kComplexOnAction();

    }

    if (ke.getCode() == KeyCode.UP) {
        refreshZoom(+1);
    }

    if (ke.getCode() == KeyCode.DOWN) {
        refreshZoom(-1);
    }

    if (ke.getCode() == KeyCode.W) {
        awakeButtonOnAction();
        if (featureModel.getLabel(currentEpoch) == -1) {
            goToEpoch(currentEpoch + 1);
        }
    }

    if (ke.getCode() == KeyCode.R) {
        remButtonOnAction();
        if (featureModel.getLabel(currentEpoch) == -1) {
            goToEpoch(currentEpoch + 1);
        }
    }

    if (ke.getCode() == KeyCode.DIGIT1) {
        s1ButtonOnAction();
        if (featureModel.getLabel(currentEpoch) == -1) {
            goToEpoch(currentEpoch + 1);
        }
    }

    if (ke.getCode() == KeyCode.DIGIT2) {
        s2ButtonOnAction();
        if (featureModel.getLabel(currentEpoch) == -1) {
            goToEpoch(currentEpoch + 1);
        }
    }

    if (ke.getCode() == KeyCode.DIGIT3) {
        s3ButtonOnAction();
        if (featureModel.getLabel(currentEpoch) == -1) {
            goToEpoch(currentEpoch + 1);
        }
    }

    if (ke.getCode() == KeyCode.A) {
        artefactButtonOnAction();
    }

    if (ke.getCode() == KeyCode.M) {
        arousalButtonOnAction();
    }

    if (ke.getCode() == KeyCode.D) {
        stimulationButtonOnAction();
    }

    if (ke.getCode() == KeyCode.C) {
        clearButtonOnAction();
    }

    if (ke.getCode() == KeyCode.PAGE_DOWN) {
        goToEpoch(currentEpoch - 10);
    }

    if (ke.getCode() == KeyCode.PAGE_UP) {
        goToEpoch(currentEpoch + 10);
    }

    if (ke.getCode() == KeyCode.END) {
        goToEpoch(dataModel.getNumberOf30sEpochs() - 1);
    }

    if (ke.getCode() == KeyCode.HOME) {
        goToEpoch(0);
    }

    if (ke.getCode() == KeyCode.F6) {
        visualizeButtonAction();
    }
    if (ke.getCode() == KeyCode.F7) {
        filterButtonAction();
    }
    if (ke.getCode() == KeyCode.F8) {
        dcRemoveButtonAction();
    }
    if (ke.getCode() == KeyCode.F9) {
        kcMarkersButtonAction();
    }
    if (ke.getCode() == KeyCode.F12) {
        electrodeConfiguratorButtonAction();
    }
}