Java JFrame getViewMenu(JFrame mainFrame)

Here you can find the source of getViewMenu(JFrame mainFrame)

Description

get View Menu

License

Open Source License

Declaration

private static JMenu getViewMenu(JFrame mainFrame) 

Method Source Code

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

import javax.swing.JFrame;

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

import javax.swing.MenuElement;

public class Main {
    private static final String MENU_NAME = "Window";

    private static JMenu getViewMenu(JFrame mainFrame) {
        JMenuBar menuBar = mainFrame.getJMenuBar();
        MenuElement[] menuElements = menuBar.getSubElements();
        for (MenuElement menuElement : menuElements) {
            if (menuElement instanceof JMenu) {
                JMenu menu = (JMenu) menuElement;
                String name = menu.getText();
                if (name.equalsIgnoreCase(MENU_NAME)) {
                    return menu;
                }/* w  w w.  ja v  a 2  s .  c o m*/
            }
        }
        return null;
    }
}

Related

  1. getRootJFrame(Component c)
  2. getRootJFrame(Component component)
  3. getTheJFrame(String title, int width, int height, int x, int y)
  4. getTopJFrame(Container c)
  5. getUserInput(JFrame _frame, String arg1, String arg2, Object arg3)
  6. giveFrameHalfScreen(final JFrame frame)
  7. igualarFormularios(JFrame destino, JFrame origen)
  8. inputFiles(JFrame argParent)
  9. installEscapeCloseOperation(final JFrame dialog)