Example usage for javafx.scene.input KeyCode S

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

Introduction

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

Prototype

KeyCode S

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

Click Source Link

Document

Constant for the S key.

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Keyboard");
    Group root = new Group();
    Scene scene = new Scene(root, 530, 300, Color.WHITE);

    MenuBar menuBar = new MenuBar();
    menuBar.prefWidthProperty().bind(primaryStage.widthProperty());
    root.getChildren().add(menuBar);//from  ww  w  .ja  v  a2 s .com

    Menu menu = new Menu("File");
    menuBar.getMenus().add(menu);

    MenuItem newItem = MenuItemBuilder.create().text("New")
            .accelerator(new KeyCodeCombination(KeyCode.N, KeyCombination.CONTROL_DOWN))
            .onAction(new EventHandler<ActionEvent>() {
                public void handle(ActionEvent event) {
                    System.out.println("Ctrl-N");
                }
            }).build();
    menu.getItems().add(newItem);

    MenuItem saveItem = MenuItemBuilder.create().text("Save")
            .accelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN))
            .onAction(new EventHandler<ActionEvent>() {
                public void handle(ActionEvent event) {
                    System.out.println("Ctrl-S");
                }
            }).build();
    menu.getItems().add(saveItem);

    menu.getItems().add(new SeparatorMenuItem());

    MenuItem exitItem = MenuItemBuilder.create().text("Exit")
            .accelerator(new KeyCodeCombination(KeyCode.X, KeyCombination.CONTROL_DOWN))
            .onAction(new EventHandler<ActionEvent>() {
                public void handle(ActionEvent event) {
                    System.out.println("Ctrl-X");
                }
            }).build();
    menu.getItems().add(exitItem);

    primaryStage.setScene(scene);
    primaryStage.show();
}

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);/*from   ww  w.j a  va2  s.c om*/
    stage.setTitle("Keyboard Example");
    stage.show();
}

From source file:jviewmda.JViewMda.java

@Override
public void start(Stage primaryStage) {
    m_stage = primaryStage;/*from  w w w .  jav  a2 s .c  om*/

    String array_path = "";
    Parameters params = getParameters();
    List<String> unnamed_params = params.getUnnamed();
    if (unnamed_params.size() > 0) {
        array_path = unnamed_params.get(0);
    }
    // FOR DEBUGING PURPOSES
    if (array_path.length() == 0) {
        //String debug_path = "/home/magland/wisdm/www/wisdmfileserver/files/fetalmri/sessions/SESSION1/crops/FNP001A-coronal.crop.mda";
        String debug_path = "/home/magland/data/LesionProbe/Images/ID001_FLAIR.nii";
        if ((new File(debug_path)).exists()) {
            array_path = debug_path;
        }
    }

    Menu menu;
    MenuItem item;

    MenuBar menubar = new MenuBar();

    //file menu
    menu = new Menu("File");
    menubar.getMenus().add(menu);
    item = new MenuItem("Open...");
    item.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.CONTROL_DOWN));
    item.setOnAction(e -> on_file_open());
    menu.getItems().add(item);
    item = new MenuItem("Save As...");
    item.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN));
    item.setOnAction(e -> on_file_saveas());
    menu.getItems().add(item);
    menu.getItems().add(new SeparatorMenuItem()); /////////////////////////////////////////////
    item = new MenuItem("Exit");
    item.setAccelerator(new KeyCodeCombination(KeyCode.X, KeyCombination.CONTROL_DOWN));
    item.setOnAction(e -> on_file_exit());
    menu.getItems().add(item);

    //view menu
    menu = new Menu("View");
    menubar.getMenus().add(menu);
    item = new MenuItem("Zoom In");
    item.setAccelerator(new KeyCodeCombination(KeyCode.Z, KeyCombination.CONTROL_DOWN));
    item.setOnAction(e -> on_zoom_in());
    menu.getItems().add(item);
    item = new MenuItem("Zoom Out");
    item.setAccelerator(
            new KeyCodeCombination(KeyCode.Z, KeyCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN));
    item.setOnAction(e -> on_zoom_out());
    menu.getItems().add(item);
    menu.getItems().add(new SeparatorMenuItem()); /////////////////////////////////////////////
    {
        CheckMenuItem item0 = new CheckMenuItem("Top Controls");
        item0.setSelected(true);
        item0.setOnAction(e -> {
            m_widget.setTopControlsVisible(item0.isSelected());
        });
        menu.getItems().add(item0);
    }
    {
        CheckMenuItem item0 = new CheckMenuItem("Bottom Controls");
        item0.setSelected(true);
        item0.setOnAction(e -> {
            m_widget.setBottomControlsVisible(item0.isSelected());
        });
        menu.getItems().add(item0);
    }
    {
        CheckMenuItem item0 = new CheckMenuItem("Brightness/Contrast");
        item0.setSelected(true);
        item0.setOnAction(e -> {
            m_widget.setBrightnessContrastVisible(item0.isSelected());
        });
        menu.getItems().add(item0);
    }
    {
        CheckMenuItem item0 = new CheckMenuItem("Slice Slider");
        item0.setSelected(true);
        item0.setOnAction(e -> {
            m_widget.setSliceSliderVisible(item0.isSelected());
        });
        menu.getItems().add(item0);
    }

    //selection menu
    menu = new Menu("Selection");
    menubar.getMenus().add(menu);
    Map<String, CheckMenuItem> mode_items = new HashMap<>();
    m_selection_mode_items = mode_items;
    mode_items.put("rectangle", new CheckMenuItem("Rectangle"));
    mode_items.put("ellipse", new CheckMenuItem("Ellipse"));
    Set<String> keys = mode_items.keySet();
    for (String key : keys) {
        CheckMenuItem item0 = mode_items.get(key);
        menu.getItems().add(item0);
        item0.setOnAction(evt -> {
            on_selection_mode_changed(key);
        });

    }
    mode_items.get("rectangle").setSelected(true);

    VBox root = new VBox();
    root.getChildren().addAll(menubar, m_widget);

    Scene scene = new Scene(root, 500, 450);

    primaryStage.setTitle("JViewMda");
    primaryStage.setScene(scene);
    primaryStage.show();

    if (array_path.length() > 0) {
        open_file(array_path);
    }

    m_prefs = Preferences.userNodeForPackage(this.getClass());

}

From source file:com.esri.geoevent.test.performance.ui.OrchestratorController.java

/**
 * Handle action related to input (in this case specifically only responds
 * to keyboard event CTRL-A)./*from  w  w w.j  ava  2 s  .  c o m*/
 *
 * @param event Input event.
 */
@FXML
public void handleKeyInput(final InputEvent event) {
    if (event instanceof KeyEvent) {
        final KeyEvent keyEvent = (KeyEvent) event;
        if (keyEvent.isControlDown() && keyEvent.getCode() == KeyCode.A) {
            provideAboutFunctionality();
        } else if (keyEvent.isControlDown() && keyEvent.getCode() == KeyCode.R) {
            showReportOptionsDialog();
        } else if (keyEvent.isControlDown() && keyEvent.getCode() == KeyCode.O) {
            openFixturesFile();
        } else if (keyEvent.isControlDown() && keyEvent.getCode() == KeyCode.S) {
            saveFixturesFile();
        } else if (keyEvent.isControlDown() && keyEvent.getCode() == KeyCode.L) {
            showLoggerDialog();
        }
    }
}

From source file:de.ks.text.AsciiDocEditor.java

@Override
public void initialize(URL location, ResourceBundle resources) {
    initializePreview();//w  w w  .j a va  2  s.  c o  m
    initializePopupPreview();

    renderGroup = new LastExecutionGroup<>("adocrender", 500, controller.getExecutorService());

    text.bindBidirectional(editor.textProperty());

    editor.textProperty().addListener((p, o, n) -> {
        if (n != null) {
            renderGroup.schedule(() -> n)//
                    .thenApplyAsync(s -> {
                        storeBack(s);
                        return s;
                    }, controller.getExecutorService())//
                    .thenAcceptAsync(s -> {
                        if (previewTab.isSelected()) {
                            preview.clear();
                            preview.showDirect(s);
                        } else {
                            preview.preload(
                                    Collections.singletonList(new AsciiDocContent(AsciiDocViewer.DEFAULT, s)));
                        }
                        if (previewPopupStage != null) {
                            popupPreview.clear();
                            popupPreview.showDirect(s);
                        }
                    }, controller.getJavaFXExecutor());
        }
    });

    tabPane.focusedProperty().addListener((p, o, n) -> {
        if (n) {
            if (tabPane.getSelectionModel().getSelectedIndex() == 0) {
                if (focusOnEditor) {
                    editor.requestFocus();
                }
            }
        } else {
            focusOnEditor = true;
        }
    });

    tabPane.getSelectionModel().selectedIndexProperty().addListener((p, o, n) -> {
        if (n != null && n.intValue() == 1) {
            controller.getJavaFXExecutor().submit(() -> preview.requestFocus());
            preview.show(new AsciiDocContent(AsciiDocViewer.DEFAULT, editor.getText()));
        }
        if (o == null || n == null) {
            return;
        }
        if (o.intValue() != 0 && n.intValue() == 0) {
            controller.getJavaFXExecutor().submit(() -> editor.requestFocus());
        }
    });
    addCommands();

    editor.setOnKeyPressed(e -> {
        KeyCode code = e.getCode();
        if (code == KeyCode.S && e.isControlDown()) {
            saveToFile();
            e.consume();
        }
        if (e.getCode() == KeyCode.P && e.isControlDown()) {
            showPreviewPopup();
            e.consume();
        }
        if (e.getCode() == KeyCode.F && e.isControlDown()) {
            showSearchField();
            e.consume();
        }
    });
    searchField.setVisible(false);
    searchField.setOnKeyPressed(e -> {
        if (e.getCode() == KeyCode.ENTER) {
            searchForText();
            e.consume();
        }
    });
    searchField.setOnKeyReleased(e -> {
        if (e.getCode() == KeyCode.ESCAPE) {
            if (searchField.textProperty().getValueSafe().trim().isEmpty()) {
                searchField.setVisible(false);
                editor.requestFocus();
            } else {
                searchField.setText("");
            }
        }
    });
}

From source file:de.pixida.logtest.designer.MainWindow.java

private void createAndAppendFileMenuItems(final Menu menu) {
    final Menu newDocument = new Menu("New");
    final Menu open = new Menu("Open");
    for (final Type type : Editor.Type.values()) {
        final MenuItem newFile = new MenuItem(type.getName());
        newFile.setOnAction(event -> this.handleCreateNewDocument(type));
        newDocument.getItems().add(newFile);

        if (type.supportsFilesProperty().get()) {
            final MenuItem openFile = new MenuItem(type.getName());
            openFile.setOnAction(event -> {
                final FileChooser fileChooser = this.createFileDialog(type, "Open");
                final File selectedFile = fileChooser.showOpenDialog(this.primaryStage);
                if (selectedFile != null) {
                    this.applyFolderOfSelectedFileInOpenOrSaveAsFileDialog(selectedFile);
                    this.handleLoadDocument(type, selectedFile);
                }//from  w  w  w  .  j a  v a 2s.  com
            });
            open.getItems().add(openFile);
        }
    }

    this.menuItemSave = new MenuItem("Save");
    this.menuItemSave.setGraphic(Icons.getIconGraphics("disk"));
    this.menuItemSave.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN));
    this.menuItemSave.setOnAction(event -> this.handleSaveDocument());

    this.menuItemSaveAs = new MenuItem("Save as");
    this.menuItemSaveAs.setOnAction(event -> this.handleSaveDocumentAs());

    final MenuItem exit = new MenuItem("Exit");
    exit.setOnAction(event -> this.handleExitApplication());

    menu.getItems().addAll(newDocument, open, this.menuItemSave, this.menuItemSaveAs, new SeparatorMenuItem(),
            exit);
}

From source file:com.properned.application.SystemController.java

public void loadFileList(File selectedFile) {
    Platform.runLater(new Runnable() {

        @Override//from  w w  w  . j  av  a  2s. co  m
        public void run() {
            logger.info("Load the file list associated to '" + selectedFile.getAbsolutePath() + "'");

            if (MultiLanguageProperties.getInstance().getIsDirty()) {
                ButtonType result = askForSave();
                if (result.getButtonData() == ButtonData.CANCEL_CLOSE) {
                    // The file must not be loaded
                    return;
                }
            }
            Preferences.getInstance().setLastPathUsed(selectedFile.getAbsolutePath());
            String fileName = selectedFile.getName();
            String baseNameTemp = fileName.substring(0, fileName.lastIndexOf("."));

            if (fileName.contains("_")) {
                baseNameTemp = fileName.substring(0, fileName.indexOf("_"));
            }
            final String baseName = baseNameTemp;

            List<PropertiesFile> fileList = Arrays
                    .asList(selectedFile.getParentFile().listFiles(new FileFilter() {
                        @Override
                        public boolean accept(File pathname) {
                            return pathname.isFile() && pathname.getName().startsWith(baseName)
                                    && pathname.getName().endsWith(".properties");
                        }
                    })).stream().map(new Function<File, PropertiesFile>() {
                        @Override
                        public PropertiesFile apply(File t) {
                            String language = "";
                            if (t.getName().contains("_")) {
                                language = t.getName().substring(t.getName().indexOf("_") + 1,
                                        t.getName().lastIndexOf("."));
                            }
                            return new PropertiesFile(t.getAbsolutePath(), baseName, new Locale(language));
                        }
                    }).collect(Collectors.<PropertiesFile>toList());

            try {
                multiLanguageProperties.loadFileList(baseName, fileList);
                Preferences.getInstance().addFileToRecentFileList(selectedFile.getAbsolutePath());
                Properned.getInstance().getPrimaryStage().getScene()
                        .setOnKeyReleased(new EventHandler<KeyEvent>() {
                            @Override
                            public void handle(KeyEvent event) {
                                if (event.getCode() == KeyCode.S && event.isControlDown()) {
                                    logger.info("CTRL-S detected");
                                    save();
                                    event.consume();
                                }
                            }
                        });
            } catch (IOException e) {
                Properned.getInstance().showError(MessageReader.getInstance().getMessage("error.load"), e);
            }
        }
    });
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param vbRacine panel d'installation du menu
 * @throws Exception Exceptions/*www  . jav a2s.  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:org.craftercms.social.migration.controllers.MainController.java

@Override
public void initialize(final URL location, final ResourceBundle resources) {
    configTable();/*from w  ww .  j a v  a 2  s . c  o  m*/
    mnuQuit.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(final ActionEvent actionEvent) {
            stopTasks();
            Platform.exit();
        }
    });
    ctxClearLog.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(final ActionEvent actionEvent) {
            logTable.getItems().clear();
        }
    });
    ctxClearProfileSelection.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(final ActionEvent actionEvent) {
            lstProfileScripts.getSelectionModel().clearSelection();
        }
    });
    ctxClearSocialSelection.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(final ActionEvent actionEvent) {
            lstSocialScripts.getSelectionModel().clearSelection();
        }
    });

    lstProfileScripts.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    lstSocialScripts.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    lstProfileScripts.setCellFactory(new Callback<ListView, ListCell>() {
        @Override
        public ListCell call(final ListView listView) {
            return new FileListCell();
        }
    });
    lstSocialScripts.setCellFactory(new Callback<ListView, ListCell>() {
        @Override
        public ListCell call(final ListView listView) {
            return new FileListCell();
        }
    });
    ctxReloadProfileScrp.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(final ActionEvent actionEvent) {
            lstProfileScripts.getItems().clear();
            try {
                extractBuildInScripts("profile", lstProfileScripts);
            } catch (MigrationException e) {
                log.error("Unable to extract BuildIn scripts");
            }
            loadScripts(MigrationTool.systemProperties.getString("crafter.migration.profile.scripts"),
                    lstProfileScripts);
        }
    });
    ctxReloadSocialScrp.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(final ActionEvent actionEvent) {
            lstSocialScripts.getItems().clear();
            try {
                extractBuildInScripts("profile", lstSocialScripts);
            } catch (MigrationException e) {
                log.error("Unable to extract BuildIn scripts");
            }
            loadScripts(MigrationTool.systemProperties.getString("crafter.migration.social.scripts"),
                    lstSocialScripts);
        }
    });
    final MigrationSelectionAction selectionEventHandler = new MigrationSelectionAction();
    rbtMigrateProfile.setOnAction(selectionEventHandler);
    rbtMigrateSocial.setOnAction(selectionEventHandler);
    loadScripts();
    loadDefaultValues();
    saveLog.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN));
    saveLog.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(final ActionEvent event) {
            FileChooser fileChooser = new FileChooser();
            fileChooser.setTitle("Save Migration Log");
            fileChooser.setInitialFileName("Crafter-Migration-"
                    + new SimpleDateFormat("yyyy-MM-dd@HH_mm").format(new Date()) + ".html");
            final File savedFile = fileChooser.showSaveDialog(scene.getWindow());
            if (savedFile == null) {
                return;
            }
            try {
                getHtml(new FileWriter(savedFile));
                log.info("Saved Html log file");
            } catch (IOException | TransformerException ex) {
                log.error("Unable to save file", ex);
            }
        }
    });
    mnuStart.setAccelerator(new KeyCodeCombination(KeyCode.F5));
    mnuStart.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(final ActionEvent event) {

            if (currentTask == null || !currentTask.isRunning()) {
                ObservableList scriptsToRun;
                if (rbtMigrateProfile.isSelected()) {
                    scriptsToRun = lstProfileScripts.getSelectionModel().getSelectedItems();
                } else {
                    scriptsToRun = lstSocialScripts.getSelectionModel().getSelectedItems();
                }
                currentTask = new MigrationPipeService(logTable, pgbTaskProgress, srcHost.getText(),
                        srcPort.getText(), srcDb.getText(), dstHost.getText(), dstPort.getText(),
                        dstDb.getText(), scriptsToRun);
            }
            if (!currentTask.isRunning()) {
                final Thread t = new Thread(currentTask, "Migration Task");
                t.start();
            }
        }
    });
}

From source file:qupath.lib.gui.tma.TMASummaryViewer.java

private void initialize() {

    model = new TMATableModel();

    groupByIDProperty.addListener((v, o, n) -> refreshTableData());

    MenuBar menuBar = new MenuBar();
    Menu menuFile = new Menu("File");
    MenuItem miOpen = new MenuItem("Open...");
    miOpen.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN));
    miOpen.setOnAction(e -> {//from   ww w .  j  a va  2  s. com
        File file = QuPathGUI.getDialogHelper(stage).promptForFile(null, null, "TMA data files",
                new String[] { "qptma" });
        if (file == null)
            return;
        setInputFile(file);
    });

    MenuItem miSave = new MenuItem("Save As...");
    miSave.setAccelerator(
            new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    miSave.setOnAction(
            e -> SummaryMeasurementTableCommand.saveTableModel(model, null, Collections.emptyList()));

    MenuItem miImportFromImage = new MenuItem("Import from current image...");
    miImportFromImage.setAccelerator(
            new KeyCodeCombination(KeyCode.I, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    miImportFromImage.setOnAction(e -> setTMAEntriesFromOpenImage());

    MenuItem miImportFromProject = new MenuItem("Import from current project... (experimental)");
    miImportFromProject.setAccelerator(
            new KeyCodeCombination(KeyCode.P, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    miImportFromProject.setOnAction(e -> setTMAEntriesFromOpenProject());

    MenuItem miImportClipboard = new MenuItem("Import from clipboard...");
    miImportClipboard.setOnAction(e -> {
        String text = Clipboard.getSystemClipboard().getString();
        if (text == null) {
            DisplayHelpers.showErrorMessage("Import scores", "Clipboard is empty!");
            return;
        }
        int n = importScores(text);
        if (n > 0) {
            setTMAEntries(new ArrayList<>(entriesBase));
        }
        DisplayHelpers.showMessageDialog("Import scores", "Number of scores imported: " + n);
    });

    Menu menuEdit = new Menu("Edit");
    MenuItem miCopy = new MenuItem("Copy table to clipboard");
    miCopy.setOnAction(e -> {
        SummaryMeasurementTableCommand.copyTableContentsToClipboard(model, Collections.emptyList());
    });

    combinedPredicate.addListener((v, o, n) -> {
        // We want any other changes triggered by this to have happened, 
        // so that the data has already been updated
        Platform.runLater(() -> handleTableContentChange());
    });

    // Reset the scores for missing cores - this ensures they will be NaN and not influence subsequent results
    MenuItem miResetMissingScores = new MenuItem("Reset scores for missing cores");
    miResetMissingScores.setOnAction(e -> {
        int changes = 0;
        for (TMAEntry entry : entriesBase) {
            if (!entry.isMissing())
                continue;
            boolean changed = false;
            for (String m : entry.getMeasurementNames().toArray(new String[0])) {
                if (!TMASummaryEntry.isSurvivalColumn(m) && !Double.isNaN(entry.getMeasurementAsDouble(m))) {
                    entry.putMeasurement(m, null);
                    changed = true;
                }
            }
            if (changed)
                changes++;
        }
        if (changes == 0) {
            logger.info("No changes made when resetting scores for missing cores!");
            return;
        }
        logger.info("{} change(s) made when resetting scores for missing cores!", changes);
        table.refresh();
        updateSurvivalCurves();
        if (scatterPane != null)
            scatterPane.updateChart();
        if (histogramDisplay != null)
            histogramDisplay.refreshHistogram();
    });
    menuEdit.getItems().add(miResetMissingScores);

    QuPathGUI.addMenuItems(menuFile, miOpen, miSave, null, miImportClipboard, null, miImportFromImage,
            miImportFromProject);
    menuBar.getMenus().add(menuFile);
    menuEdit.getItems().add(miCopy);
    menuBar.getMenus().add(menuEdit);

    menuFile.setOnShowing(e -> {
        boolean imageDataAvailable = QuPathGUI.getInstance() != null
                && QuPathGUI.getInstance().getImageData() != null
                && QuPathGUI.getInstance().getImageData().getHierarchy().getTMAGrid() != null;
        miImportFromImage.setDisable(!imageDataAvailable);
        boolean projectAvailable = QuPathGUI.getInstance() != null
                && QuPathGUI.getInstance().getProject() != null
                && !QuPathGUI.getInstance().getProject().getImageList().isEmpty();
        miImportFromProject.setDisable(!projectAvailable);
    });

    // Double-clicking previously used for comments... but conflicts with tree table expansion
    //      table.setOnMouseClicked(e -> {
    //         if (!e.isPopupTrigger() && e.getClickCount() > 1)
    //            promptForComment();
    //      });

    table.setPlaceholder(new Text("Drag TMA data folder onto window, or choose File -> Open"));
    table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    BorderPane pane = new BorderPane();
    pane.setTop(menuBar);
    menuBar.setUseSystemMenuBar(true);

    // Create options
    ToolBar toolbar = new ToolBar();
    Label labelMeasurementMethod = new Label("Combination method");
    labelMeasurementMethod.setLabelFor(comboMeasurementMethod);
    labelMeasurementMethod
            .setTooltip(new Tooltip("Method whereby measurements for multiple cores with the same "
                    + TMACoreObject.KEY_UNIQUE_ID + " will be combined"));

    CheckBox cbHidePane = new CheckBox("Hide pane");
    cbHidePane.setSelected(hidePaneProperty.get());
    cbHidePane.selectedProperty().bindBidirectional(hidePaneProperty);

    CheckBox cbGroupByID = new CheckBox("Group by ID");
    entriesBase.addListener((Change<? extends TMAEntry> event) -> {
        if (!event.getList().stream().anyMatch(e -> e.getMetadataValue(TMACoreObject.KEY_UNIQUE_ID) != null)) {
            cbGroupByID.setSelected(false);
            cbGroupByID.setDisable(true);
        } else {
            cbGroupByID.setDisable(false);
        }
    });
    cbGroupByID.setSelected(groupByIDProperty.get());
    cbGroupByID.selectedProperty().bindBidirectional(groupByIDProperty);

    CheckBox cbUseSelected = new CheckBox("Use selection only");
    cbUseSelected.selectedProperty().bindBidirectional(useSelectedProperty);

    CheckBox cbSkipMissing = new CheckBox("Hide missing cores");
    cbSkipMissing.selectedProperty().bindBidirectional(skipMissingCoresProperty);
    skipMissingCoresProperty.addListener((v, o, n) -> {
        table.refresh();
        updateSurvivalCurves();
        if (histogramDisplay != null)
            histogramDisplay.refreshHistogram();
        updateSurvivalCurves();
        if (scatterPane != null)
            scatterPane.updateChart();
    });

    toolbar.getItems().addAll(labelMeasurementMethod, comboMeasurementMethod,
            new Separator(Orientation.VERTICAL), cbHidePane, new Separator(Orientation.VERTICAL), cbGroupByID,
            new Separator(Orientation.VERTICAL), cbUseSelected, new Separator(Orientation.VERTICAL),
            cbSkipMissing);
    comboMeasurementMethod.getItems().addAll(MeasurementCombinationMethod.values());
    comboMeasurementMethod.getSelectionModel().select(MeasurementCombinationMethod.MEDIAN);
    selectedMeasurementCombinationProperty.addListener((v, o, n) -> table.refresh());

    ContextMenu popup = new ContextMenu();
    MenuItem miSetMissing = new MenuItem("Set missing");
    miSetMissing.setOnAction(e -> setSelectedMissingStatus(true));

    MenuItem miSetAvailable = new MenuItem("Set available");
    miSetAvailable.setOnAction(e -> setSelectedMissingStatus(false));

    MenuItem miExpand = new MenuItem("Expand all");
    miExpand.setOnAction(e -> {
        if (table.getRoot() == null)
            return;
        for (TreeItem<?> item : table.getRoot().getChildren()) {
            item.setExpanded(true);
        }
    });
    MenuItem miCollapse = new MenuItem("Collapse all");
    miCollapse.setOnAction(e -> {
        if (table.getRoot() == null)
            return;
        for (TreeItem<?> item : table.getRoot().getChildren()) {
            item.setExpanded(false);
        }
    });
    popup.getItems().addAll(miSetMissing, miSetAvailable, new SeparatorMenuItem(), miExpand, miCollapse);
    table.setContextMenu(popup);

    table.setRowFactory(e -> {
        TreeTableRow<TMAEntry> row = new TreeTableRow<>();

        //         // Make rows invisible if they don't pass the predicate
        //         row.visibleProperty().bind(Bindings.createBooleanBinding(() -> {
        //               TMAEntry entry = row.getItem();
        //               if (entry == null || (entry.isMissing() && skipMissingCoresProperty.get()))
        //                     return false;
        //               return entries.getPredicate() == null || entries.getPredicate().test(entry);
        //               },
        //               skipMissingCoresProperty,
        //               entries.predicateProperty()));

        // Style rows according to what they contain
        row.styleProperty().bind(Bindings.createStringBinding(() -> {
            if (row.isSelected())
                return "";
            TMAEntry entry = row.getItem();
            if (entry == null || entry instanceof TMASummaryEntry)
                return "";
            else if (entry.isMissing())
                return "-fx-background-color:rgb(225,225,232)";
            else
                return "-fx-background-color:rgb(240,240,245)";
        }, row.itemProperty(), row.selectedProperty()));
        //         row.itemProperty().addListener((v, o, n) -> {
        //            if (n == null || n instanceof TMASummaryEntry || row.isSelected())
        //               row.setStyle("");
        //            else if (n.isMissing())
        //               row.setStyle("-fx-background-color:rgb(225,225,232)");            
        //            else
        //               row.setStyle("-fx-background-color:rgb(240,240,245)");            
        //         });
        return row;
    });

    BorderPane paneTable = new BorderPane();
    paneTable.setTop(toolbar);
    paneTable.setCenter(table);

    MasterDetailPane mdTablePane = new MasterDetailPane(Side.RIGHT, paneTable, createSidePane(), true);

    mdTablePane.showDetailNodeProperty().bind(Bindings.createBooleanBinding(
            () -> !hidePaneProperty.get() && !entriesBase.isEmpty(), hidePaneProperty, entriesBase));
    mdTablePane.setDividerPosition(2.0 / 3.0);

    pane.setCenter(mdTablePane);

    model.getEntries().addListener(new ListChangeListener<TMAEntry>() {
        @Override
        public void onChanged(ListChangeListener.Change<? extends TMAEntry> c) {
            if (histogramDisplay != null)
                histogramDisplay.refreshHistogram();
            updateSurvivalCurves();
            if (scatterPane != null)
                scatterPane.updateChart();
        }
    });

    Label labelPredicate = new Label();
    labelPredicate.setPadding(new Insets(5, 5, 5, 5));
    labelPredicate.setAlignment(Pos.CENTER);
    //      labelPredicate.setStyle("-fx-background-color: rgba(20, 120, 20, 0.15);");
    labelPredicate.setStyle("-fx-background-color: rgba(120, 20, 20, 0.15);");

    labelPredicate.textProperty().addListener((v, o, n) -> {
        if (n.trim().length() > 0)
            pane.setBottom(labelPredicate);
        else
            pane.setBottom(null);
    });
    labelPredicate.setMaxWidth(Double.MAX_VALUE);
    labelPredicate.setMaxHeight(labelPredicate.getPrefHeight());
    labelPredicate.setTextAlignment(TextAlignment.CENTER);
    predicateMeasurements.addListener((v, o, n) -> {
        if (n == null)
            labelPredicate.setText("");
        else if (n instanceof TablePredicate) {
            TablePredicate tp = (TablePredicate) n;
            if (tp.getOriginalCommand().trim().isEmpty())
                labelPredicate.setText("");
            else
                labelPredicate.setText("Predicate: " + tp.getOriginalCommand());
        } else
            labelPredicate.setText("Predicate: " + n.toString());
    });
    //      predicate.set(new TablePredicate("\"Tumor\" > 100"));

    scene = new Scene(pane);

    scene.addEventHandler(KeyEvent.KEY_PRESSED, e -> {
        KeyCode code = e.getCode();
        if ((code == KeyCode.SPACE || code == KeyCode.ENTER) && entrySelected != null) {
            promptForComment();
            return;
        }
    });

}