java.lang.Object
ij.Menus
This class installs and updates ImageJ's menus. Note that menu labels,
even in submenus, must be unique. This is because ImageJ uses a single
hash table for all menu labels. If you look closely, you will see that
File->Import->Text Image... and File->Save As->Text Image... do not use
the same label. One of the labels has an extra space.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charstatic final intstatic final intstatic final charstatic final charstatic final intstatic final intstatic final intstatic final intstatic final charstatic final charstatic intstatic final intstatic final charstatic final charstatic final charstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds a command to the ImageJ menu bar.static voidaddOpenRecentItem(String path) Adds a file path to the beginning of the File/Open Recent submenu.static booleancommandInUse(String command) static intconvertShortcutToCode(String shortcut) static Fontstatic HashtableReturns the hashtable that associates commands with plugins.static MenugetExamplesMenu(ActionListener listener) static FontgetFont()static FontgetFont(boolean checkSize) static intReturns the size (in points) used for the fonts in ImageJ menus.static MenugetImageJMenu(String menuPath) Returns the specified ImageJ menu (e.g., "File>New") or null if it is not found.static StringgetJarFileForMenuEntry(String menuEntry) intstatic HashtableReturns the hashtable that associates keyboard shortcuts with macros.static Menustatic StringReturns the path to the macros directory or null if the macros directory was not found.static MenuBarstatic Menuintstatic String[]Returns a list of the plugins in the plugins menu.static StringReturns the path to the user plugins directory or null if the plugins directory was not found.static PopupMenustatic Menustatic HashtableReturns the hashtable that associates shortcuts with commands.static intinstallPlugin(String plugin, char menuCode, String command, String shortcut, ImageJ ij) Adds a plugin based command to the end of a specified menu.voidinstallUserPlugin(String className, boolean force) static voidsavePreferences(Properties prefs) Called once when ImageJ quits.static voidsetFontSize(int size) Set the size (in points) used for the fonts in ImageJ menus.static booleanshortcutInUse(String shortcut) Returns 'true' if this keyboard shortcut is in use.static intuninstallPlugin(String command) Deletes a command installed by Plugins/Shortcuts/Add Shortcut.static voidstatic voidstatic voidUpdates the Image/Type and Window menus.static voidupdateWindowMenuItem(ImagePlus imp, String oldLabel, String newLabel) Changes the name of an item in the Window menu.static voidupdateWindowMenuItem(String oldLabel, String newLabel) Changes the name of an item in the Window menu.
-
Field Details
-
PLUGINS_MENU
public static final char PLUGINS_MENU- See Also:
-
IMPORT_MENU
public static final char IMPORT_MENU- See Also:
-
SAVE_AS_MENU
public static final char SAVE_AS_MENU- See Also:
-
SHORTCUTS_MENU
public static final char SHORTCUTS_MENU- See Also:
-
ABOUT_MENU
public static final char ABOUT_MENU- See Also:
-
FILTERS_MENU
public static final char FILTERS_MENU- See Also:
-
TOOLS_MENU
public static final char TOOLS_MENU- See Also:
-
UTILITIES_MENU
public static final char UTILITIES_MENU- See Also:
-
WINDOW_MENU_ITEMS
public static final int WINDOW_MENU_ITEMS- See Also:
-
NORMAL_RETURN
public static final int NORMAL_RETURN- See Also:
-
COMMAND_IN_USE
public static final int COMMAND_IN_USE- See Also:
-
INVALID_SHORTCUT
public static final int INVALID_SHORTCUT- See Also:
-
SHORTCUT_IN_USE
public static final int SHORTCUT_IN_USE- See Also:
-
NOT_INSTALLED
public static final int NOT_INSTALLED- See Also:
-
COMMAND_NOT_FOUND
public static final int COMMAND_NOT_FOUND- See Also:
-
MAX_OPEN_RECENT_ITEMS
public static final int MAX_OPEN_RECENT_ITEMS- See Also:
-
setMenuBarCount
public static int setMenuBarCount
-
-
Method Details
-
getExamplesMenu
-
getJarFileForMenuEntry
-
getImageJMenu
Returns the specified ImageJ menu (e.g., "File>New") or null if it is not found. -
getPlugins
Returns a list of the plugins in the plugins menu. -
installUserPlugin
-
getMenuBar
-
getMacrosMenu
-
getOpenRecentMenu
-
getMacroCount
public int getMacroCount() -
getPluginCount
public int getPluginCount() -
updateMenus
public static void updateMenus()Updates the Image/Type and Window menus. -
getPlugInsPath
Returns the path to the user plugins directory or null if the plugins directory was not found. -
getMacrosPath
Returns the path to the macros directory or null if the macros directory was not found. -
getCommands
Returns the hashtable that associates commands with plugins. -
getShortcuts
Returns the hashtable that associates shortcuts with commands. The keys in the hashtable are Integer keycodes, or keycode+200 for uppercase. -
getMacroShortcuts
Returns the hashtable that associates keyboard shortcuts with macros. The keys in the hashtable are Integer keycodes, or keycode+200 for uppercase. -
updateWindowMenuItem
Changes the name of an item in the Window menu. -
updateWindowMenuItem
Changes the name of an item in the Window menu. -
addOpenRecentItem
Adds a file path to the beginning of the File/Open Recent submenu. -
getPopupMenu
-
getSaveAsMenu
-
installPlugin
public static int installPlugin(String plugin, char menuCode, String command, String shortcut, ImageJ ij) Adds a plugin based command to the end of a specified menu.- Parameters:
plugin- the plugin (e.g. "Inverter_", "Inverter_("arg")")menuCode- PLUGINS_MENU, IMPORT_MENU, SAVE_AS_MENU or HOT_KEYScommand- the menu item label (set to "" to uninstall)shortcut- the keyboard shortcut (e.g. "y", "Y", "F1")ij- ImageJ (the action listener)- Returns:
- returns an error code(NORMAL_RETURN,COMMAND_IN_USE_ERROR, etc.)
-
uninstallPlugin
Deletes a command installed by Plugins/Shortcuts/Add Shortcut. -
commandInUse
-
convertShortcutToCode
-
shortcutInUse
Returns 'true' if this keyboard shortcut is in use. -
setFontSize
public static void setFontSize(int size) Set the size (in points) used for the fonts in ImageJ menus. Set the size to 0 to use the Java default size. -
getFontSize
public static int getFontSize()Returns the size (in points) used for the fonts in ImageJ menus. Returns 0 if the default font size is being used or if this is a Macintosh. -
getFont
-
getFont
-
getCachedFont
-
savePreferences
Called once when ImageJ quits. -
updateImageJMenus
public static void updateImageJMenus() -
updateFont
public static void updateFont() -
add
Adds a command to the ImageJ menu bar.
-