本文整理了Java中javax.swing.JMenuBar.getMenuCount()
方法的一些代码示例,展示了JMenuBar.getMenuCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuBar.getMenuCount()
方法的具体详情如下:
包路径:javax.swing.JMenuBar
类名称:JMenuBar
方法名:getMenuCount
暂无
代码示例来源:origin: groovy/groovy-core
/**
* Provide the standard Groovy <code>size()</code> method for <code>JMenuBar</code>.
*
* @param self a JMenuBar
* @return the menu count of the menuBar
* @since 1.6.4
*/
public static int size(JMenuBar self) {
return self.getMenuCount();
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
/**
* Provide the standard Groovy <code>size()</code> method for <code>JMenuBar</code>.
*
* @param self a JMenuBar
* @return the menu count of the menuBar
* @since 1.6.4
*/
public static int size(JMenuBar self) {
return self.getMenuCount();
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
/**
* Provide the standard Groovy <code>size()</code> method for <code>JMenuBar</code>.
*
* @param self a JMenuBar
* @return the menu count of the menuBar
* @since 1.6.4
*/
public static int size(JMenuBar self) {
return self.getMenuCount();
}
代码示例来源:origin: org.codehaus.groovy/groovy-swing
/**
* Provide the standard Groovy <code>size()</code> method for <code>JMenuBar</code>.
*
* @param self a JMenuBar
* @return the menu count of the menuBar
* @since 1.6.4
*/
public static int size(JMenuBar self) {
return self.getMenuCount();
}
代码示例来源:origin: org.zaproxy/zap
private void addMenuHelper(JMenuBar menuBar, List<JMenuItem> items, int existingCount) {
for (JMenuItem item : items) {
if (item != null) {
menuBar.add(item, menuBar.getMenuCount() - existingCount);
}
}
menuBar.revalidate();
}
代码示例来源: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: 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: 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: 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: 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: edu.stanford.protege/protege-editor-owl
private static 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 Optional.of(menu);
}
}
}
}
return Optional.absent();
}
代码示例来源:origin: raydac/netbeans-mmd-plugin
private void enableAllMenuItems() {
for (int i = 0; i < this.mainMenu.getMenuCount(); i++) {
enableMenu(this.mainMenu.getMenu(i));
}
}
代码示例来源:origin: UISpec4J/UISpec4J
public void check() {
String[] actual = new String[jMenuBar.getMenuCount()];
for (int i = 0; i < actual.length; i++) {
actual[i] = jMenuBar.getMenu(i).getText();
}
ArrayUtils.assertEquals(menuNames, actual);
}
};
代码示例来源: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: 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: 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;
}
代码示例来源: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: 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: 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;
}
内容来源于网络,如有侵权,请联系作者删除!