Search in sources :

Example 26 with Menu

use of java.awt.Menu in project cryptomator by cryptomator.

the class TrayMenuController method buildSubmenu.

private Menu buildSubmenu(Vault vault) {
    Menu submenu = new Menu(vault.getDisplayName());
    if (vault.isLocked()) {
        MenuItem unlockItem = new MenuItem(resourceBundle.getString("traymenu.vault.unlock"));
        unlockItem.addActionListener(createActionListenerForVault(vault, this::unlockVault));
        submenu.add(unlockItem);
    } else if (vault.isUnlocked()) {
        MenuItem lockItem = new MenuItem(resourceBundle.getString("traymenu.vault.lock"));
        lockItem.addActionListener(createActionListenerForVault(vault, this::lockVault));
        submenu.add(lockItem);
        MenuItem revealItem = new MenuItem(resourceBundle.getString("traymenu.vault.reveal"));
        revealItem.addActionListener(createActionListenerForVault(vault, this::revealVault));
        submenu.add(revealItem);
    }
    return submenu;
}
Also used : MenuItem(java.awt.MenuItem) Menu(java.awt.Menu) PopupMenu(java.awt.PopupMenu)

Example 27 with Menu

use of java.awt.Menu in project TrakEM2 by trakem2.

the class Utils method restoreMenuBar.

/**
 *Restore ImageJ's MenuBar
 */
public static final void restoreMenuBar() {
    final MenuBar menu_bar = Menus.getMenuBar();
    final int n_menus = menu_bar.getMenuCount();
    for (int i = 0; i < n_menus; i++) {
        final Menu menu = menu_bar.getMenu(i);
        restoreMenu(menu);
    }
// make sure there isn't a null menu bar
// WindowManager.getCurrentWindow().setMenuBar(menu_bar);
}
Also used : MenuBar(java.awt.MenuBar) JMenu(javax.swing.JMenu) Menu(java.awt.Menu) JPopupMenu(javax.swing.JPopupMenu)

Aggregations

Menu (java.awt.Menu)27 MenuItem (java.awt.MenuItem)15 PopupMenu (java.awt.PopupMenu)9 JPopupMenu (javax.swing.JPopupMenu)8 MenuBar (java.awt.MenuBar)7 MenuShortcut (java.awt.MenuShortcut)7 CheckboxMenuItem (java.awt.CheckboxMenuItem)6 JMenuItem (javax.swing.JMenuItem)6 Dimension (java.awt.Dimension)4 Frame (java.awt.Frame)3 MemoryImageSource (java.awt.image.MemoryImageSource)3 JMenu (javax.swing.JMenu)3 KeyStroke (javax.swing.KeyStroke)3 BorderLayout (java.awt.BorderLayout)2 JFrame (javax.swing.JFrame)2 JPanel (javax.swing.JPanel)2 Pair (catdata.Pair)1 AqlCodeEditor (catdata.aql.gui.AqlCodeEditor)1 NraViewer (catdata.nested.NraViewer)1 SqlChecker (catdata.opl.SqlChecker)1