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

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

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

JMenu.getText介绍

暂无

代码示例

代码示例来源:origin: ron190/jsql-injection

public String getSelectedItem() {
  return this.menu.getText();
}

代码示例来源:origin: robward-scisys/sldeditor

/**
 * Gets the selected item.
 *
 * @return the selected item
 */
public String getSelectedItem() {
  return menu.getText();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public int compare(Object o1, Object o2) {
  JMenu menuOne = (JMenu)o1;
  JMenu menuTwo = (JMenu)o2;
  if (menuTwo == null || menuOne == null) return 0;
  String menuOneText = menuOne.getText();
  String menuTwoText = menuTwo.getText();
  if (menuTwoText == null || menuOneText == null) return 0;
  return menuOneText.compareTo(menuTwoText);
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application

private void logCreateMenu(MenuActionPlugin plugin, JComponent menuContainer) {
  if (logger.isDebugEnabled()) {
    if (menuContainer instanceof JMenuBar) {
      logger.debug("Adding " + plugin + " to menu bar");
    }
    else if (menuContainer instanceof JMenu) {
      logger.debug("Giving " + ((JMenu) menuContainer).getText() + " the child " + plugin);
    }
    else {
      logger.debug("Modify this log message, please");
    }
  }
}

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

@ScriptFunction(jsDoc = TEXT_JSDOC)
@Override
public String getText() {
  return super.getText();
}

代码示例来源:origin: protegeproject/protege

private static java.util.Optional<JMenu> getMenu(JMenuBar menuBar, String name) {
  for (int i = 0; i < menuBar.getMenuCount(); i++) {
    JMenu menu = menuBar.getMenu(i);
    if (menu != null) {
      if (menu.getText() != null) {
        if (menu.getText().equals(name)) {
          return java.util.Optional.of(menu);
        }
      }
    }
  }
  return java.util.Optional.empty();
}

代码示例来源:origin: jtrfp/terminal-recall

@Override
  public int compare(JMenu l, JMenu r) {
  final double leftPos  = positionOf(l);
  final double rightPos = positionOf(r);
  final double result = leftPos - rightPos;
  if(result != 0)
    return (int)(result*10000);
  return l.getText().compareTo(r.getText());
  }
}//end JMenuComparator

代码示例来源:origin: org.cytoscape/swing-util-api

@Override
public void addMenu(final JMenu newSubmenu, final double gravity) {
      final int index = getInsertLocation(newSubmenu.getText(), gravity);
      menu.insert(newSubmenu, index);
      componentGravity.put(newSubmenu, gravity);
      logger.info("Inserted menu: " + newSubmenu + " with gravity: " + gravity);
}

代码示例来源:origin: org.cytoscape/swing-util-api

@Override
public void addMenu(final JMenu newSubmenu, final double gravity) {
      final int index = getInsertLocation(newSubmenu.getText(), gravity);
      menu.insert(newSubmenu, index);
      componentGravity.put(newSubmenu, gravity);
      logger.debug("Inserted menu: " + newSubmenu + " with gravity: " + gravity);
}

代码示例来源:origin: org.protege/protege-editor-owl

private static JMenu getMenu(JMenuBar menuBar, String name) {
  for (int i = 0; i < menuBar.getMenuCount(); i++) {
    if (menuBar.getMenu(i).getText() != null) {
      if (menuBar.getMenu(i).getText().equals(name)) {
        return menuBar.getMenu(i);
      }
    }
  }
  return null;
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

private static JMenu getMenu(JMenuBar menuBar, String name) {
  for (int i = 0; i < menuBar.getMenuCount(); i++) {
    if (menuBar.getMenu(i).getText() != null) {
      if (menuBar.getMenu(i).getText().equals(name)) {
        return menuBar.getMenu(i);
      }
    }
  }
  return null;
}

代码示例来源:origin: org.protege/protege-editor-core-application

public JMenu getMenu(String name) {
  for (int i = 0; i < getJMenuBar().getMenuCount(); i++) {
    JMenu menu = getJMenuBar().getMenu(i);
    if (menu.getText() != null) {
      if (menu.getText().equals(name)) {
        return menu;
      }
    }
  }
  JMenu menu = new JMenu(name);
  getJMenuBar().add(menu);
  return menu;
}

代码示例来源:origin: protegeproject/protege

public JMenu getMenu(String name) {
  for (int i = 0; i < getJMenuBar().getMenuCount(); i++) {
    JMenu menu = getJMenuBar().getMenu(i);
    if (menu.getText() != null) {
      if (menu.getText().equals(name)) {
        return menu;
      }
    }
  }
  JMenu menu = new JMenu(name);
  getJMenuBar().add(menu);
  return menu;
}

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

public Icon getIcon()
{
 if(BuPreferences.BU.getBooleanProperty("icons.menu",true)||
   (super.getText()==null))
  return super.getIcon();
 return null;
}

代码示例来源:origin: robotframework/SwingLibrary

@RobotKeyword("Selects all items from the menu of the window that was opened first and returns their names.\n\n"
  + "Example:\n"
  + "| @{mainMenuItemNames}= | `Get Main Menu Item Names` |\n"
  + "| `Should Contain` | @{mainMenuItemNames} | File |\n")
public List<String> getMainMenuItemNames() {
  JMenuBarOperator mbo = menubarOperator();
  List<String> returnable = new ArrayList<String>();
  for (int index = 0; index < mbo.getMenuCount(); index++) {
    returnable.add(mbo.getMenu(index).getText());
  }
  return returnable;
}

代码示例来源:origin: stackoverflow.com

JMenuBar menubar1 = getJMenuBar();
for (int i = 0; i < menubar1.getMenuCount(); i++) {
  JMenu menu1 = menubar1.getMenu(i);
  System.out.println("Menu:" + menu1.getText());
  for (int j = 0; j < menu1.getMenuComponentCount(); j++) {
    java.awt.Component comp = menu1.getMenuComponent(j);
    if (comp instanceof JMenuItem) {
      JMenuItem menuItem1 = (JMenuItem) comp;
      System.out.println("MenuItem:" + menuItem1.getText());
    }
  }
}

代码示例来源:origin: stackoverflow.com

JMenuBar menubar1 = getJMenuBar();
for (int i = 0; i < menubar1.getMenuCount(); i++) {
  JMenu menu1 = menubar1.getMenu(i);
  System.out.println("Menu:" + menu1.getText());
  for (int j = 0; j < menu1.getMenuComponentCount(); j++) {
    java.awt.Component comp = menu1.getMenuComponent(j);
    if (comp instanceof JMenuItem) {
      JMenuItem menuItem1 = (JMenuItem) comp;
      System.out.println("MenuItem:" + menuItem1.getText());
    }
  }
}

代码示例来源:origin: UISpec4J/UISpec4J

public void check() {
  String[] actual = new String[jMenuBar.getMenuCount()];
  for (int i = 0; i < actual.length; i++) {
   actual[i] = jMenuBar.getMenu(i).getText();
  }
  ArrayUtils.assertEquals(menuNames, actual);
 }
};

代码示例来源:origin: robotframework/SwingLibrary

@RobotKeyword("Selects an item from the menu of the window that was opened first and returns it's name.\n\n"
  + "Example:\n"
  + "| ${mainMenuItemName}= | `Get Main Menu Item Name` | 0                   |\n"
  + "| `Should Be Equal`    | File                      | ${mainMenuItemName} |\n")
@ArgumentNames({"index"})
public String getMainMenuItemName(String index) {
  if (!isIndex(index)) {
    throw new UnsupportedOperationException("The argument must be an index.");
  }
  return menubarOperator().getMenu(asIndex(index)).getText();
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

public void adicionaMenu(JMenu submenu, boolean usaToggleButtons)
  {
    Action acoes[] = new Action[submenu.getItemCount()];

    for (int i = 0; i < submenu.getItemCount(); i++)
    {
      acoes[i] = submenu.getItem(i).getAction();
    }

    adicionaGrupoDeItems(submenu.getText(), submenu.getIcon(), acoes, usaToggleButtons);
  }
}

相关文章