@ScriptFunction(jsDoc = COUNT_JSDOC) @Override public int getCount() { return super.getComponentCount(); }
/** * Returns all occurences of the specified string in the menus and menu * items of the associated menu bar. * * @param searchPattern * Pattern to search (no wildcards yet). * @return All occurences of the specified string in the menus and menu * items of the associated menu bar. */ private LinkedList<SearchResult> findOccurences(String searchPattern) { LinkedList<SearchResult> result = new LinkedList<SearchResult>(); LinkedList<JMenu> currentPath = new LinkedList<JMenu>(); for (int i = 0; i < jcomp.getComponentCount(); i++) { Component component = jcomp.getComponent(i); if (component instanceof JMenu) { JMenu menu = (JMenu) component; this.checkMenu(currentPath, menu, searchPattern, result); } } return result; }
public void addMenu(Menu m) { JMenuBar jmb = getSwingMenu(); // If we have a help menu, add new menus add the last - 1 position, // otherwise we append at the end. if (helpMenu != null) { jmb.add(getSwingMenu(m), jmb.getComponentCount() - 1); } else { jmb.add(getSwingMenu(m)); } // Force re-layout. jmb.revalidate(); }
new_parent.setMnemonic('T'); } else { menubar.add(new_parent, menubar.getComponentCount() - 1);
/** * Refresh main menu with currently loaded GUI plugins. * * @since 0.3.1 */ public static void refreshMenu() { instance.usedKeyStrokes.clear(); while (instance.menu.getComponentCount() > 2) instance.menu.remove(1); for (Class<? extends Plugin> plugin : PluginSystem.getPlugins(IGUIModule.class)) { try { IGUIModule pluginInstance = ((Class<? extends IGUIModule>) plugin).newInstance(); String menuName = pluginInstance.getMenu(); JMenuItem item = getCurrentMenu(instance.menu, null, menuName); item.addActionListener(instance); KeyStroke keystroke = pluginInstance.getKeyStroke(); if (keystroke != null && !instance.usedKeyStrokes.contains(keystroke)) { item.setAccelerator(keystroke); instance.usedKeyStrokes.add(keystroke); } instance.itemObject.put(item, plugin); } catch (NoClassDefFoundError e) { throw new Net2PlanException("Class " + e.getMessage() + " cannot be found. A dependence for " + plugin.getSimpleName() + " is missing?"); } catch (Throwable e) { throw new RuntimeException(e); } } instance.menu.revalidate(); }
Component removed = null; for (int i = 0; i < MenuSearchWidget.this.jcomp .getComponentCount(); i++) { if (MenuSearchWidget.this.jcomp.getComponent(i) instanceof SearchPanel) { removed = MenuSearchWidget.this.jcomp MenuSearchWidget.this.jcomp .add(removed, MenuSearchWidget.this.jcomp .getComponentCount());
/** * Overrides the base class version in order to create and configure the VISAT's main pane. */ @Override protected JComponent createMainPane() { final JMenuBar menuBar = getMainFrame().getJMenuBar(); JMenu windowMenu = null; for (int i = 0; i < menuBar.getComponentCount(); i++) { final Component component = menuBar.getComponent(i); if (component instanceof JMenu && "window".equals(component.getName())) { windowMenu = (JMenu) menuBar.getComponent(i); } } desktopPane.setWindowMenu(windowMenu); return desktopPane; }
mb.add(editMenu, Math.min(1, mb.getComponentCount())); mb.add(viewMenu, Math.min(2, mb.getComponentCount()));
index = mMenuBar.getComponentCount() + index + 1; mMenuBar.add(menuItem, index);
mb.add(editMenu, Math.min(1, mb.getComponentCount())); mb.add(viewMenu, Math.min(2, mb.getComponentCount()));
mb.add(editMenu, Math.min(1, mb.getComponentCount())); mb.add(viewMenu, Math.min(2, mb.getComponentCount()));
.getLafSupport(); this.searchPanel = new SearchPanel(this.jcomp); this.jcomp.add(searchPanel, this.jcomp.getComponentCount()); this.searchPanel.setVisible(lafSupport.toInstallMenuSearch(this.jcomp));