Java JMenuBar findMenu(JMenuBar menuBar, String menuName)

Here you can find the source of findMenu(JMenuBar menuBar, String menuName)

Description

find Menu

License

Open Source License

Declaration

public static JMenu findMenu(JMenuBar menuBar, String menuName) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.JMenu;
import javax.swing.JMenuBar;

import javax.swing.MenuElement;

public class Main {
    public static JMenu findMenu(JMenuBar menuBar, String menuName) {
        MenuElement[] menus = menuBar.getSubElements();
        for (int ii = 0; ii < menus.length; ++ii) {
            JMenu menu = (JMenu) menus[ii].getComponent();
            if (menu.getText().equals(menuName))
                return menu;
        }// w  w w  .j  ava  2s .c o  m
        return null;
    }
}

Related

  1. applyDefaultProperties(final JMenuBar comp)
  2. cloneMenuBar(final JMenuBar menubar)
  3. createMenuInMenuBar(final JMenuBar menuBar, final String menuName)
  4. findItem(JMenuBar menuBar, String menuName, String menuItemName)
  5. findMenu(JMenuBar bar, Class type)
  6. findMenu(JMenuBar menuBar, String menuName, String subMenuName)
  7. findMenu(JMenuBar menuBar, String name, boolean deepSearch)
  8. findMenuComponent( JMenuBar menuBar, String menuName, String menuComponentName, Class componentClass)
  9. findMenuPosition(JMenuBar menuBar, String name)