本文整理汇总了Java中java.awt.Menu.getItemCount方法的典型用法代码示例。如果您正苦于以下问题:Java Menu.getItemCount方法的具体用法?Java Menu.getItemCount怎么用?Java Menu.getItemCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Menu
的用法示例。
在下文中一共展示了Menu.getItemCount方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setEnabled
import java.awt.Menu; //导入方法依赖的package包/类
@Override
public final void setEnabled(final boolean b) {
super.setEnabled(b);
final Menu target = (Menu) getTarget();
final int count = target.getItemCount();
for (int i = 0; i < count; ++i) {
MenuItem item = target.getItem(i);
MenuItemPeer p = (MenuItemPeer) LWCToolkit.targetToPeer(item);
if (p != null) {
p.setEnabled(b && item.isEnabled());
}
}
}
示例2: addItems
import java.awt.Menu; //导入方法依赖的package包/类
void addItems()
{
if(!itemsAdded)
{
Menu o = (Menu)owner;
for( int i=0; i < o.getItemCount(); i++ )
{
MenuItem ci = o.getItem(i);
if (ci instanceof Menu && ci.getPeer() != null)
((QtMenuPeer)ci.getPeer()).addItems();
addItem( ci );
}
itemsAdded = true;
}
}
示例3: SwingMenuPeer
import java.awt.Menu; //导入方法依赖的package包/类
/**
* Creates a new <code>SwingMenuPeer</code> instance.
*
* @param awtMenu the AWT menu
*/
public SwingMenuPeer(Menu awtMenu)
{
this.awtMenu = awtMenu;
menu = new SwingMenu();
menu.setDoubleBuffered(false);
menu.setText(awtMenu.getLabel());
for (int i = 0; i < awtMenu.getItemCount(); i++)
{
MenuItem item = awtMenu.getItem(i);
item.addNotify();
SwingMenuItemPeer peer = (SwingMenuItemPeer) item.getPeer();
menu.add(peer.menuItem);
}
}
示例4: enableMenu
import java.awt.Menu; //导入方法依赖的package包/类
private void enableMenu(Menu menu) {
menu.setEnabled(true);
for(int i = 0; i < menu.getItemCount(); i++) {
MenuItem item = menu.getItem(i);
if(item instanceof Menu) {
enableMenu((Menu)item);
} else {
item.setEnabled(true);
}
}
}
示例5: addItems
import java.awt.Menu; //导入方法依赖的package包/类
void addItems()
{
if(!itemsAdded)
{
Menu o = (Menu)owner;
for( int i=0; i < o.getItemCount(); i++ )
{
MenuItem ci = o.getItem(i);
if (ci instanceof Menu && ci.getPeer() != null)
((QtMenuPeer)ci.getPeer()).addItems();
addItem( ci );
}
itemsAdded = true;
}
}
示例6: SwingMenuPeer
import java.awt.Menu; //导入方法依赖的package包/类
/**
* Creates a new <code>SwingMenuPeer</code> instance.
*
* @param awtMenu the AWT menu
*/
public SwingMenuPeer(Menu awtMenu)
{
this.awtMenu = awtMenu;
menu = new SwingMenu();
menu.setDoubleBuffered(false);
menu.setText(awtMenu.getLabel());
for (int i = 0; i < awtMenu.getItemCount(); i++)
{
MenuItem item = awtMenu.getItem(i);
item.addNotify();
SwingMenuItemPeer peer = (SwingMenuItemPeer) item.getPeer();
menu.add(peer.menuItem);
}
}
示例7: getMenuItem
import java.awt.Menu; //导入方法依赖的package包/类
/**
* Returns the index of the MenuItem labeled by the specified string.
*
* @param menu
* the java.awt.Menu to be parsed
* @param label
* the java.awt.MenuItem label being searched
* @return the index of the java.awt.MenuItem. Returns {@code -1} if no
* match is found, {@code null} if menu is not available.
*/
private Integer getMenuItem(final Menu menu, final String label) {
int position = -1;
if (menu == null) {
return null;
}
for (int i = 0; i < menu.getItemCount(); i++) {
if (menu.getItem(i).getLabel().equals(label)) {
position = i;
break;
}
}
return position;
}
示例8: restoreMenu
import java.awt.Menu; //导入方法依赖的package包/类
static private void restoreMenu(final Menu menu) {
final int n_menuitems = menu.getItemCount();
for (int i=0; i<n_menuitems; i++) {
final MenuItem menu_item = menu.getItem(i);
if (menu_item instanceof Menu) {
restoreMenu((Menu)menu_item);
}
menu_item.setEnabled(true);
}
}