List of usage examples for javax.swing JMenu getName
public String getName()
From source file:Main.java
public final static JMenu getJMenu(JMenuBar menubar, String menuName) { JMenu theMenu = null;//from w w w . j av a2s .c om for (int i = 0; i < menubar.getMenuCount(); i++) { JMenu m = menubar.getMenu(i); //menubar may have components that are not JMenu. //Therefore, m may be NULL. See: JMenubar.getMenu() if (m != null && m.getName().equals(menuName)) { theMenu = m; i = menubar.getMenuCount();//break } } return theMenu; }
From source file:org.colombbus.tangara.commons.resinject.ClassResourceImpl.java
@Override public void inject(JMenu menu) { String key = menu.getName(); Validate.notEmpty(key, "menu argument has no name"); //$NON-NLS-1$ JMenuInjecter injecter = new JMenuInjecter(); injecter.setClassResource(this); injecter.setKey(key);/*from ww w . j a v a 2 s. c o m*/ injecter.setMenu(menu); injecter.inject(); }
From source file:uk.nhs.cfh.dsp.srth.desktop.uiframework.utils.ActionComponentManager.java
/** * Gets the menu index.// ww w.ja v a2 s .c o m * * @param name the name * * @return the menu index */ private synchronized int getMenuIndex(String name) { /* check if menu already exists in menu bar, but the name would have been added as 'fileMenu', instead of 'file' */ int menuIndex = -1; for (int i = 0; i < menuBar.getMenuCount(); i++) { JMenu m = menuBar.getMenu(i); if (m.getName().equalsIgnoreCase(name + "Menu")) { menuIndex = i; break; } } return menuIndex; }