本文整理了Java中javax.swing.JMenuBar.getMenu()
方法的一些代码示例,展示了JMenuBar.getMenu()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuBar.getMenu()
方法的具体详情如下:
包路径:javax.swing.JMenuBar
类名称:JMenuBar
方法名:getMenu
暂无
代码示例来源:origin: groovy/groovy-core
/**
* Support the subscript operator for JMenuBar.
*
* @param self a JMenuBar
* @param index the index of the menu to get
* @return the menu at the given index
* @since 1.6.4
*/
public static JMenu getAt(JMenuBar self, int index) {
return self.getMenu(index);
}
代码示例来源:origin: raydac/netbeans-mmd-plugin
private void enableAllMenuItems() {
for (int i = 0; i < this.mainMenu.getMenuCount(); i++) {
enableMenu(this.mainMenu.getMenu(i));
}
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl
private static JMenu getMenu(JMenuBar menuBar, String name) {
for (int i = 0; i < menuBar.getMenuCount(); i++) {
if (menuBar.getMenu(i).getText() != null) {
if (menuBar.getMenu(i).getText().equals(name)) {
return menuBar.getMenu(i);
}
}
}
return null;
}
代码示例来源:origin: log4j/log4j
/**
* Removes old file list and creates a new file list
* with the updated MRU list.
*/
protected void updateMRUList() {
JMenu menu = _logMonitorFrame.getJMenuBar().getMenu(0);
menu.removeAll();
menu.add(createOpenMI());
menu.add(createOpenURLMI());
menu.addSeparator();
menu.add(createCloseMI());
createMRUFileListMI(menu);
menu.addSeparator();
menu.add(createExitMI());
}
代码示例来源:origin: org.protege/protege-editor-owl
private static JMenu getMenu(JMenuBar menuBar, String name) {
for (int i = 0; i < menuBar.getMenuCount(); i++) {
if (menuBar.getMenu(i).getText() != null) {
if (menuBar.getMenu(i).getText().equals(name)) {
return menuBar.getMenu(i);
}
}
}
return null;
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Removes old file list and creates a new file list
* with the updated MRU list.
*/
protected void updateMRUList() {
JMenu menu = _logMonitorFrame.getJMenuBar().getMenu(0);
menu.removeAll();
menu.add(createOpenMI());
menu.add(createOpenURLMI());
menu.addSeparator();
menu.add(createCloseMI());
createMRUFileListMI(menu);
menu.addSeparator();
menu.add(createExitMI());
}
代码示例来源:origin: org.appdapter/org.appdapter.lib.gui
public void setJMenuBar(JMenuBar mBar) {
synchronized (mBar) {
int mc = mBar.getMenuCount();
for (int i = 0; i < mc; i++) {
Utility.getMenuBar().add(mBar.getMenu(i));
}
}
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
/**
* Support the subscript operator for JMenuBar.
*
* @param self a JMenuBar
* @param index the index of the menu to get
* @return the menu at the given index
* @since 1.6.4
*/
public static JMenu getAt(JMenuBar self, int index) {
return self.getMenu(index);
}
代码示例来源:origin: cpesch/RouteConverter
public static JMenu findMenu(JMenuBar menuBar, String menuName) {
for (int i = 0; i < menuBar.getMenuCount(); i++) {
JMenu menu = menuBar.getMenu(i);
if (menuName.equals(menu.getName()))
return menu;
}
return null;
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
/**
* Support the subscript operator for JMenuBar.
*
* @param self a JMenuBar
* @param index the index of the menu to get
* @return the menu at the given index
* @since 1.6.4
*/
public static JMenu getAt(JMenuBar self, int index) {
return self.getMenu(index);
}
代码示例来源:origin: senbox-org/snap-desktop
public static int findMenuPosition(JMenuBar menuBar, String name) {
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;
}
代码示例来源:origin: org.codehaus.groovy/groovy-swing
/**
* Support the subscript operator for JMenuBar.
*
* @param self a JMenuBar
* @param index the index of the menu to get
* @return the menu at the given index
* @since 1.6.4
*/
public static JMenu getAt(JMenuBar self, int index) {
return self.getMenu(index);
}
代码示例来源:origin: sc.fiji/3D_Viewer
public ShortCuts(final JMenuBar menubar) {
commands = new ArrayList<String>();
items = new HashMap<String, JMenuItem>();
shortcuts = UniverseSettings.shortcuts;
for (int i = 0; i < menubar.getMenuCount(); i++)
scan(menubar.getMenu(i), "");
for (final String command : commands) {
final String shortcut = shortcuts.get(command);
if (shortcut != null) setShortCut(command, shortcut);
}
}
代码示例来源:origin: UISpec4J/UISpec4J
/**
* Returns a {@link MenuItem} component representing a top-level menu (for instance File/Edit/etc.).
* That MenuItem can be used then to access the individual menu commands, or other submenus.
*/
public MenuItem getMenu(String menuName) {
int menuIndex = getMenuIndex(menuName);
AssertAdapter.assertFalse("Menu '" + menuName + "' does not exist", menuIndex == -1);
JMenu menu = jMenuBar.getMenu(menuIndex);
return new MenuItem(menu);
}
代码示例来源:origin: sc.fiji/fiji-lib
@Override
public void populateActions() {
for (int i = 0; i < menuBar.getMenuCount(); i++) {
JMenu menu = menuBar.getMenu(i);
populateActions(menu, menu.getLabel());
}
}
代码示例来源:origin: protegeproject/protege
private static java.util.Optional<JMenu> getMenu(JMenuBar menuBar, String name) {
for (int i = 0; i < menuBar.getMenuCount(); i++) {
JMenu menu = menuBar.getMenu(i);
if (menu != null) {
if (menu.getText() != null) {
if (menu.getText().equals(name)) {
return java.util.Optional.of(menu);
}
}
}
}
return java.util.Optional.empty();
}
代码示例来源:origin: org.boofcv/demonstrations
protected void setMenuBarEnabled( boolean enabled ) {
menuBar.setEnabled(enabled);
for (int i = 0; i < menuBar.getMenuCount(); i++) {
menuBar.getMenu(i).setEnabled(enabled);
}
}
代码示例来源:origin: stackoverflow.com
JMenuBar menubar1 = getJMenuBar();
for (int i = 0; i < menubar1.getMenuCount(); i++) {
JMenu menu1 = menubar1.getMenu(i);
System.out.println("Menu:" + menu1.getText());
for (int j = 0; j < menu1.getMenuComponentCount(); j++) {
java.awt.Component comp = menu1.getMenuComponent(j);
if (comp instanceof JMenuItem) {
JMenuItem menuItem1 = (JMenuItem) comp;
System.out.println("MenuItem:" + menuItem1.getText());
}
}
}
代码示例来源:origin: stackoverflow.com
JMenuBar menubar1 = getJMenuBar();
for (int i = 0; i < menubar1.getMenuCount(); i++) {
JMenu menu1 = menubar1.getMenu(i);
System.out.println("Menu:" + menu1.getText());
for (int j = 0; j < menu1.getMenuComponentCount(); j++) {
java.awt.Component comp = menu1.getMenuComponent(j);
if (comp instanceof JMenuItem) {
JMenuItem menuItem1 = (JMenuItem) comp;
System.out.println("MenuItem:" + menuItem1.getText());
}
}
}
代码示例来源:origin: protegeproject/protege
public JMenu getMenu(String name) {
for (int i = 0; i < getJMenuBar().getMenuCount(); i++) {
JMenu menu = getJMenuBar().getMenu(i);
if (menu.getText() != null) {
if (menu.getText().equals(name)) {
return menu;
}
}
}
JMenu menu = new JMenu(name);
getJMenuBar().add(menu);
return menu;
}
内容来源于网络,如有侵权,请联系作者删除!