List of utility methods to do JMenuBar
T | findMenuComponent(JMenuBar menuBar, String menuName, String menuComponentName, Class find Menu Component JMenu menu = findMenu(menuBar, menuName); if (menu != null) { return findMenuComponent(menu, menuComponentName, componentClass); return null; |
int | findMenuPosition(JMenuBar menuBar, String name) find Menu Position 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; ... |
JMenu | getJMenu(JMenuBar menubar, String menuName) get J Menu JMenu theMenu = null; for (int i = 0; i < menubar.getMenuCount(); i++) { JMenu m = menubar.getMenu(i); if (m != null && m.getName().equals(menuName)) { theMenu = m; i = menubar.getMenuCount(); return theMenu; |
JMenu | getJMenuByName(JMenuBar bar, String name) get J Menu By Name for (Component c : bar.getComponents()) { if (c instanceof JMenu) { if (((JMenu) c).getText().equals(name)) { return (JMenu) c; return null; ... |
JMenuItem | getMenu(JMenuBar loMenuBar, String psComando) Devuelve el submenu que tiene el actioncomand psComando JMenuItem loResult = null; for (int i = 0; i < loMenuBar.getMenuCount() && loResult == null; i++) { JMenu loMenuAux = loMenuBar.getMenu(i); if (loMenuAux != null) { if (loMenuAux.getActionCommand().equals(psComando)) { loResult = loMenuBar.getMenu(i); } else { loResult = getMenu(loMenuBar.getMenu(i), psComando); ... |
JMenuItem | getMenuItem(JMenuBar menu, String text) get Menu Item for (int i = 0; i < menu.getMenuCount(); i++) { JMenuItem m = getMenuItem(menu.getMenu(i), text); if (m != null) return m; return null; |
void | launch(String title, JComponent component, JMenuBar menuBar) Muestra un componente envuelto en un JFrame. JFrame frame = new JFrame(title); if (null != menuBar) { frame.setJMenuBar(menuBar); frame.add(component); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.pack(); frame.setLocationRelativeTo(null); ... |
JMenu | menu(String text, char mnemonic, JMenuBar menuBar) menu JMenu menu = new JMenu(text); menu.setMnemonic(mnemonic); menuBar.add(menu); return menu; |
void | pushMenu(JMenuBar jmenubar, String[][] menus) push Menu Color MENU_YELLOW = new Color(236, 233, 216); Color MENU_BLUE = new Color(49, 106, 197); jmenubar.setBackground(MENU_YELLOW); for (int i = 0; i < menus.length; i++) { final JMenu jmenu = new JMenu(menus[i][0]); addHoverEffect4MenuAbout(jmenu, MENU_BLUE, Color.WHITE, MENU_YELLOW, Color.BLACK); jmenu.setBackground(MENU_YELLOW); jmenubar.add(jmenu); ... |
AbstractButton | selectMenuItem(JMenuBar menuBar, Action action, boolean selected) change the selection state of the menu item (typically a JRadioButton or JCheckboxButton) that uses the provided action. AbstractButton item = getMenuItem(menuBar, action); if (item != null) { item.setSelected(selected); return item; |