Search in sources :

Example 1 with Image3DMenubar

use of ij3d.Image3DMenubar in project GDSC-SMLM by aherbert.

the class ImageJ3DResultsViewer method createSmlmMenuBar.

/**
 * Creates the SMLM menu bar.
 *
 * @param univ the universe
 */
private void createSmlmMenuBar(Image3DUniverse univ) {
    final Image3DMenubar menubar = (Image3DMenubar) univ.getMenuBar();
    final JMenu menu = new JMenu("GDSC SMLM");
    menu.setMnemonic(KeyEvent.VK_G);
    resetRotation = new JMenuItem("Reset global rotation", KeyEvent.VK_R);
    resetRotation.addActionListener(this::menuActionPerformed);
    menu.add(resetRotation);
    resetTranslation = new JMenuItem("Reset global translation", KeyEvent.VK_T);
    resetTranslation.addActionListener(this::menuActionPerformed);
    menu.add(resetTranslation);
    resetZoom = new JMenuItem("Reset global zoom", KeyEvent.VK_Z);
    resetZoom.addActionListener(this::menuActionPerformed);
    menu.add(resetZoom);
    menu.addSeparator();
    resetAll = new JMenuItem("Reset all transformations", KeyEvent.VK_A);
    resetAll.addActionListener(this::menuActionPerformed);
    menu.add(resetAll);
    resetSelectedView = new JMenuItem("Reset selected transformation", KeyEvent.VK_S);
    resetSelectedView.addActionListener(this::menuActionPerformed);
    menu.add(resetSelectedView);
    findEyePoint = new JMenuItem("Find eye point", KeyEvent.VK_E);
    findEyePoint.addActionListener(this::menuActionPerformed);
    menu.add(findEyePoint);
    sortBackToFront = new JMenuItem("Sort Back-to-Front", KeyEvent.VK_B);
    sortBackToFront.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed B"));
    sortBackToFront.addActionListener(this::menuActionPerformed);
    menu.add(sortBackToFront);
    sortFrontToBack = new JMenuItem("Sort Front-to-Back", KeyEvent.VK_F);
    sortFrontToBack.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed R"));
    sortFrontToBack.addActionListener(this::menuActionPerformed);
    menu.add(sortFrontToBack);
    menu.addSeparator();
    changeColour = new JMenuItem("Change colour", KeyEvent.VK_O);
    changeColour.addActionListener(this::menuActionPerformed);
    menu.add(changeColour);
    changePointSize = new JMenuItem("Change point size", KeyEvent.VK_H);
    changePointSize.addActionListener(this::menuActionPerformed);
    menu.add(changePointSize);
    increasePointSize = new JMenuItem("Increase point size", KeyEvent.VK_I);
    increasePointSize.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed PERIOD"));
    increasePointSize.addActionListener(this::menuActionPerformed);
    menu.add(increasePointSize);
    decreasePointSize = new JMenuItem("Decrease point size", KeyEvent.VK_D);
    decreasePointSize.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed COMMA"));
    decreasePointSize.addActionListener(this::menuActionPerformed);
    menu.add(decreasePointSize);
    toggleTransparent = new JMenuItem("Toggle transparent", KeyEvent.VK_P);
    toggleTransparent.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed E"));
    toggleTransparent.addActionListener(this::menuActionPerformed);
    menu.add(toggleTransparent);
    toggleShaded = new JMenuItem("Toggle shaded", KeyEvent.VK_S);
    toggleShaded.addActionListener(this::menuActionPerformed);
    menu.add(toggleShaded);
    toggleDynamicTransparency = new JCheckBoxMenuItem("Toggle dynamic transparency");
    toggleDynamicTransparency.setMnemonic(KeyEvent.VK_D);
    toggleDynamicTransparency.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed D"));
    toggleDynamicTransparency.setSelected(univ.getViewer().getView().getTransparencySortingPolicy() != View.TRANSPARENCY_SORT_NONE);
    toggleDynamicTransparency.addActionListener(this::menuActionPerformed);
    menu.add(toggleDynamicTransparency);
    colourSurface = new JMenuItem("Colour surface from 2D image", KeyEvent.VK_I);
    colourSurface.addActionListener(this::menuActionPerformed);
    menu.add(colourSurface);
    menu.addSeparator();
    cropResults = new JMenuItem("Crop results", KeyEvent.VK_C);
    cropResults.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed X"));
    cropResults.addActionListener(this::menuActionPerformed);
    menu.add(cropResults);
    menu.addSeparator();
    updateSettings = new JMenuItem("Update settings", KeyEvent.VK_U);
    updateSettings.addActionListener(this::menuActionPerformed);
    menu.add(updateSettings);
    showHelp = new JMenuItem("Help", KeyEvent.VK_H);
    showHelp.addActionListener(this::menuActionPerformed);
    menu.add(showHelp);
    menubar.add(menu);
    // Add back so it is redrawn
    univ.setMenubar(menubar);
// 4.0.3 method
// univ.refreshShortcuts();
}
Also used : JMenuItem(javax.swing.JMenuItem) Image3DMenubar(ij3d.Image3DMenubar) JMenu(javax.swing.JMenu) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem)

Aggregations

Image3DMenubar (ij3d.Image3DMenubar)1 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1