javax.swing.JMenu.getName()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中javax.swing.JMenu.getName()方法的一些代码示例,展示了JMenu.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenu.getName()方法的具体详情如下:
包路径:javax.swing.JMenu
类名称:JMenu
方法名:getName

JMenu.getName介绍

暂无

代码示例

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@Override
  public String toString() {
    return String.format("%s [%s] count:%d", super.getName() != null ? super.getName() : "", getClass().getSimpleName(), getCount());
  }
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = JS_NAME_DOC)
@Override
public String getName() {
  return super.getName();
}

代码示例来源:origin: bcdev/beam

private static Command getCommandForMenu(JMenu menu, CommandManager manager) {
  final String name = menu.getName();
  return name != null ? manager.getCommand(name) : null;
}

代码示例来源:origin: senbox-org/snap-desktop

public static int findMenuPosition(JMenuBar menuBar, String name) {
  int n = menuBar.getMenuCount();
  for (int i = 0; i < n; i++) {
    JMenu menu = menuBar.getMenu(i);
    if (name.equals(menu.getName())) {
      return i;
    }
  }
  return -1;
}

代码示例来源:origin: cpesch/RouteConverter

public static JMenu findMenu(JMenuBar menuBar, String menuName) {
  for (int i = 0; i < menuBar.getMenuCount(); i++) {
    JMenu menu = menuBar.getMenu(i);
    if (menuName.equals(menu.getName()))
      return menu;
  }
  return null;
}

代码示例来源:origin: net.sf.doolin/doolin-gui

/**
 * Utility method that looks for a sub-menu using the
 * {@link JMenu#getName() name} of the menu as an identifier.
 * 
 * @param name
 *            Name to find
 * @return Found {@link JMenu} or <code>null</code>
 */
protected JMenu getMenuByName(String name) {
  int count = this.menuBar.getMenuCount();
  for (int i = 0; i < count; i++) {
    JMenu menu = this.menuBar.getMenu(i);
    if (StringUtils.equals(name, menu.getName())) {
      return menu;
    }
  }
  return null;
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

public static JMenu getMenu(MenuElement _menu, String _name)
{
 JMenu r=null;
 //synchronized(_menu)
 {
  MenuElement[] c=_menu.getSubElements();
  for(int i=0; i<c.length; i++)
  {
 if(c[i] instanceof BuMenu)
 {
  JMenu m=(JMenu)c[i];
  // System.err.println(m.getName());
  if(m.getName().equals("mn"+_name))
   { r=m; break; }
 }
 r=getMenu(c[i],_name);
 if(r!=null) break;
  }
 }
 return r;
}

代码示例来源:origin: bcdev/beam

public static JMenu findSubMenu(JPopupMenu popupMenu, String name) {
  int n = popupMenu.getComponentCount();
  for (int i = 0; i < n; i++) {
    Component c = popupMenu.getComponent(i);
    if (c instanceof JMenu) {
      JMenu subMenu = (JMenu) c;
      if (name.equals(subMenu.getName())) {
        return subMenu;
      }
      subMenu = findSubMenu(subMenu.getPopupMenu(), name);
      if (subMenu != null) {
        return subMenu;
      }
    }
  }
  return null;
}

代码示例来源:origin: senbox-org/snap-desktop

public static JMenu findSubMenu(JPopupMenu popupMenu, String name) {
  int n = popupMenu.getComponentCount();
  for (int i = 0; i < n; i++) {
    Component c = popupMenu.getComponent(i);
    if (c instanceof JMenu) {
      JMenu subMenu = (JMenu) c;
      if (name.equals(subMenu.getName())) {
        return subMenu;
      }
      subMenu = findSubMenu(subMenu.getPopupMenu(), name);
      if (subMenu != null) {
        return subMenu;
      }
    }
  }
  return null;
}

代码示例来源:origin: bcdev/beam

BeamLogManager.getSystemLogger().fine(String.format("Inserting command '%s' into menu '%s' with %d item(s)", newCommand.getCommandID(), menu.getName(), componentCount));

代码示例来源:origin: senbox-org/snap-desktop

public static JMenu findMenu(JMenuBar menuBar, String name, boolean deepSearch) {
  int n = menuBar.getMenuCount();
  for (int i = 0; i < n; i++) {
    JMenu menu = menuBar.getMenu(i);
    if (name.equals(menu.getName())) {
      return menu;
    }
  }
  if (deepSearch) {
    for (int i = 0; i < n; i++) {
      JMenu menu = menuBar.getMenu(i);
      JMenu subMenu = findSubMenu(menu.getPopupMenu(), name);
      if (subMenu != null) {
        return subMenu;
      }
    }
  }
  return null;
}

代码示例来源:origin: bcdev/beam

public static JMenu findMenu(JMenuBar menuBar, String name, boolean deepSearch) {
  int n = menuBar.getMenuCount();
  for (int i = 0; i < n; i++) {
    JMenu menu = menuBar.getMenu(i);
    if (name.equals(menu.getName())) {
      return menu;
    }
  }
  if (deepSearch) {
    for (int i = 0; i < n; i++) {
      JMenu menu = menuBar.getMenu(i);
      JMenu subMenu = findSubMenu(menu.getPopupMenu(), name);
      if (subMenu != null) {
        return subMenu;
      }
    }
  }
  return null;
}

相关文章