本文整理汇总了Java中java.awt.MenuBar.getMenuCount方法的典型用法代码示例。如果您正苦于以下问题:Java MenuBar.getMenuCount方法的具体用法?Java MenuBar.getMenuCount怎么用?Java MenuBar.getMenuCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.MenuBar
的用法示例。
在下文中一共展示了MenuBar.getMenuCount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMenus
import java.awt.MenuBar; //导入方法依赖的package包/类
/**
* Recurses the menubar adding menus (and menu items),
* called from the Frame peer.
*/
void addMenus()
{
MenuBar o = (MenuBar)owner;
int help = (o.getHelpMenu() != null) ? 1 : 0;
for (int i = 0; i < o.getMenuCount() - help; i++)
addMenu( o.getMenu(i) );
if(o.getHelpMenu() != null)
addHelpMenu( o.getHelpMenu() );
}
示例2: SwingMenuBarPeer
import java.awt.MenuBar; //导入方法依赖的package包/类
/**
* Creates a new <code>SwingMenuBarPeer</code> instance.
*
* @param awtMenuBar the AWT menu bar
*/
public SwingMenuBarPeer(MenuBar awtMenuBar)
{
this.awtMenuBar = awtMenuBar;
menuBar = new SwingMenuBar();
menuBar.setDoubleBuffered(false);
// Add all the menus that are already in the MenuBar.
for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
{
Menu menu = awtMenuBar.getMenu(i);
menu.addNotify();
addMenu(awtMenuBar.getMenu(i));
}
}
示例3: setBookOpened
import java.awt.MenuBar; //导入方法依赖的package包/类
public void setBookOpened() {
indexPanel.setVisible(true);
MenuBar bar = getMenuBar();
for(int i = 0; i < bar.getMenuCount(); i++) {
enableMenu(bar.getMenu(i));
}
}
示例4: addMenus
import java.awt.MenuBar; //导入方法依赖的package包/类
/**
* Recurses the menubar adding menus (and menu items),
* called from the Frame peer.
*/
void addMenus()
{
MenuBar o = (MenuBar)owner;
int help = (o.getHelpMenu() != null) ? 1 : 0;
for (int i = 0; i < o.getMenuCount() - help; i++)
addMenu( o.getMenu(i) );
if(o.getHelpMenu() != null)
addHelpMenu( o.getHelpMenu() );
}
示例5: setMenubar
import java.awt.MenuBar; //导入方法依赖的package包/类
/**
* Set a custom menu bar to the viewer.
*
* @deprecated Use swing instead.
*/
@Deprecated
public void setMenubar(final MenuBar mb) {
final JMenuBar jmb = new JMenuBar();
final int num = mb.getMenuCount();
for (int i = 0; i < num; i++)
jmb.add(menuToJMenu(mb.getMenu(i)));
setMenubar(jmb);
}
示例6: restoreMenuBar
import java.awt.MenuBar; //导入方法依赖的package包/类
/**Restore ImageJ's MenuBar*/
static public final void restoreMenuBar() {
final MenuBar menu_bar = Menus.getMenuBar();
final int n_menus = menu_bar.getMenuCount();
for (int i=0; i<n_menus;i++) {
final Menu menu = menu_bar.getMenu(i);
restoreMenu(menu);
}
//make sure there isn't a null menu bar
//WindowManager.getCurrentWindow().setMenuBar(menu_bar);
}
示例7: checkMenuCount
import java.awt.MenuBar; //导入方法依赖的package包/类
private static void checkMenuCount(final MenuBar bar, final int expected) {
final int actual = bar.getMenuCount();
if (actual != expected) {
throw new RuntimeException("Incorrect menus count");
}
}