for (int i=0; i<items; i++) { MenuItem mItem = menu.getItem(i); String label = mItem.getActionCommand(); if (mItem instanceof Menu) { DefaultMutableTreeNode subNode = new DefaultMutableTreeNode(label);
public void parseMenu(String path, Menu menu) { int n=menu.getItemCount(); for (int i=0; i<n; ++i) { MenuItem m=menu.getItem(i); String label=m.getActionCommand(); if (m instanceof Menu) { Menu subMenu=(Menu)m; parseMenu(path+">"+label,subMenu); } else { String trimmedLabel = label.trim(); if (trimmedLabel.length()==0 || trimmedLabel.equals("-")) continue; CommandAction ca=(CommandAction)commandsHash.get(label); if( ca == null ) commandsHash.put(label, new CommandAction(null,m,path)); else { ca.menuItem=m; ca.menuLocation=path; } CommandAction caAfter=(CommandAction)commandsHash.get(label); } } }
for (int i=0; i<items; i++) { MenuItem mItem = menu.getItem(i); String label = mItem.getActionCommand(); if (mItem instanceof Menu) { DefaultMutableTreeNode subNode = new DefaultMutableTreeNode(label);
public void parseMenu(String path, Menu menu) { int n=menu.getItemCount(); for (int i=0; i<n; ++i) { MenuItem m=menu.getItem(i); String label=m.getActionCommand(); if (m instanceof Menu) { Menu subMenu=(Menu)m; parseMenu(path+">"+label,subMenu); } else { String trimmedLabel = label.trim(); if (trimmedLabel.length()==0 || trimmedLabel.equals("-")) continue; CommandAction ca=(CommandAction)commandsHash.get(label); if( ca == null ) commandsHash.put(label, new CommandAction(null,m,path)); else { ca.menuItem=m; ca.menuLocation=path; } CommandAction caAfter=(CommandAction)commandsHash.get(label); } } }
if (lastSpace>0) // remove image size (e.g., " 90K") menuItemLabel = menuItemLabel.substring(0, lastSpace); String idString = item.getActionCommand(); int id = (int)Tools.parseDouble(idString, 0); ImagePlus imp = WindowManager.getImage(id);
if (lastSpace>0) // remove image size (e.g., " 90K") menuItemLabel = menuItemLabel.substring(0, lastSpace); String idString = item.getActionCommand(); int id = (int)Tools.parseDouble(idString, 0); ImagePlus imp = WindowManager.getImage(id);
if (command.equals(menu.getItem(i).getActionCommand())) { notAvailable(command); return null;