当前位置: 首页>>代码示例>>Java>>正文


Java MenuKeyListener类代码示例

本文整理汇总了Java中javax.swing.event.MenuKeyListener的典型用法代码示例。如果您正苦于以下问题:Java MenuKeyListener类的具体用法?Java MenuKeyListener怎么用?Java MenuKeyListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MenuKeyListener类属于javax.swing.event包,在下文中一共展示了MenuKeyListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAddGetRemoveMenuKeyListener

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public void testAddGetRemoveMenuKeyListener() {
    MenuKeyListener listener1 = new ConcreteMenuKeyListener();
    MenuKeyListener listener2 = new ConcreteMenuKeyListener();
    MenuKeyListener listener3 = new ConcreteMenuKeyListener();
    EventListener[] listenersArray = null;
    listenersArray = menuItem.getMenuKeyListeners();
    int initialValue = listenersArray.length;
    menuItem.addMenuKeyListener(listener1);
    menuItem.addMenuKeyListener(listener2);
    menuItem.addMenuKeyListener(listener2);
    listenersArray = menuItem.getMenuKeyListeners();
    assertEquals(initialValue + 3, listenersArray.length);
    menuItem.removeMenuKeyListener(listener1);
    menuItem.addMenuKeyListener(listener3);
    menuItem.addMenuKeyListener(listener3);
    listenersArray = menuItem.getMenuKeyListeners();
    assertEquals(initialValue + 4, listenersArray.length);
    menuItem.removeMenuKeyListener(listener3);
    menuItem.removeMenuKeyListener(listener3);
    listenersArray = menuItem.getMenuKeyListeners();
    assertEquals(initialValue + 2, listenersArray.length);
    menuItem.removeMenuKeyListener(listener2);
    menuItem.removeMenuKeyListener(listener2);
    listenersArray = menuItem.getMenuKeyListeners();
    assertEquals(initialValue, listenersArray.length);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:JMenuItemTest.java

示例2: addMenuKeyListener

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
/**
 * Maps {@code JMenuItem.addMenuKeyListener(MenuKeyListener)} through queue
 */
public void addMenuKeyListener(final MenuKeyListener menuKeyListener) {
    runMapping(new MapVoidAction("addMenuKeyListener") {
        @Override
        public void map() {
            ((JMenuItem) getSource()).addMenuKeyListener(menuKeyListener);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:JMenuItemOperator.java

示例3: removeMenuKeyListener

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
/**
 * Maps {@code JMenuItem.removeMenuKeyListener(MenuKeyListener)}
 * through queue
 */
public void removeMenuKeyListener(final MenuKeyListener menuKeyListener) {
    runMapping(new MapVoidAction("removeMenuKeyListener") {
        @Override
        public void map() {
            ((JMenuItem) getSource()).removeMenuKeyListener(menuKeyListener);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:JMenuItemOperator.java

示例4: fireMenuKeyPressed

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
private void fireMenuKeyPressed(MenuKeyEvent event) {
	Object[] listeners = list.getListenerList();
	for (int i = listeners.length - 2; i >= 0; i -= 2) {
		if (listeners[i] == MenuKeyListener.class) {
			((MenuKeyListener) listeners[i + 1]).menuKeyPressed(event);
		}
	}
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:9,代码来源:JPopupMenu.java

示例5: fireMenuKeyReleased

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
private void fireMenuKeyReleased(MenuKeyEvent event) {
	Object[] listeners = list.getListenerList();
	for (int i = listeners.length - 2; i >= 0; i -= 2) {
		if (listeners[i] == MenuKeyListener.class) {
			((MenuKeyListener) listeners[i + 1]).menuKeyReleased(event);
		}
	}
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:9,代码来源:JPopupMenu.java

示例6: fireMenuKeyTyped

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
private void fireMenuKeyTyped(MenuKeyEvent event) {
	Object[] listeners = list.getListenerList();
	for (int i = listeners.length - 2; i >= 0; i -= 2) {
		if (listeners[i] == MenuKeyListener.class) {
			((MenuKeyListener) listeners[i + 1]).menuKeyTyped(event);
		}
	}
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:9,代码来源:JPopupMenu.java

示例7: fireMenuKeyPressed

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
/**
 * This method fires a MenuKeyEvent to all the MenuItem's MenuKeyListeners.
 *
 * @param event The event signifying that key associated with this menu was pressed
 */
protected void fireMenuKeyPressed(MenuKeyEvent event)
{
  EventListener[] ll = listenerList.getListeners(MenuKeyListener.class);

  for (int i = 0; i < ll.length; i++)
    ((MenuKeyListener) ll[i]).menuKeyPressed(event);
}
 
开发者ID:vilie,项目名称:javify,代码行数:13,代码来源:JMenuItem.java

示例8: fireMenuKeyReleased

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
/**
 * This method fires a MenuKeyEvent to all the MenuItem's MenuKeyListeners.
 *
 * @param event The event signifying that key associated with this menu was released
 */
protected void fireMenuKeyReleased(MenuKeyEvent event)
{
  EventListener[] ll = listenerList.getListeners(MenuKeyListener.class);

  for (int i = 0; i < ll.length; i++)
    ((MenuKeyListener) ll[i]).menuKeyTyped(event);
}
 
开发者ID:vilie,项目名称:javify,代码行数:13,代码来源:JMenuItem.java

示例9: fireMenuKeyTyped

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
/**
 * This method fires a MenuKeyEvent to all the MenuItem's MenuKeyListeners.
 *
 * @param event The event signifying that key associated with this menu was typed.
 *        The key is typed when it was pressed and then released
 */
protected void fireMenuKeyTyped(MenuKeyEvent event)
{
  EventListener[] ll = listenerList.getListeners(MenuKeyListener.class);

  for (int i = 0; i < ll.length; i++)
    ((MenuKeyListener) ll[i]).menuKeyTyped(event);
}
 
开发者ID:vilie,项目名称:javify,代码行数:14,代码来源:JMenuItem.java

示例10: getMenuKeyListener

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public MenuKeyListener getMenuKeyListener() {
    return new InnerMenuKeyListener();
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:4,代码来源:FreeColAction.java

示例11: addMenuKeyListener

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public void addMenuKeyListener(MenuKeyListener l) {
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:3,代码来源:JMenuItem.java

示例12: removeMenuKeyListener

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public void removeMenuKeyListener(MenuKeyListener l) {
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:3,代码来源:JMenuItem.java

示例13: getMenuKeyListeners

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public MenuKeyListener[] getMenuKeyListeners() {
	return list.getListeners(MenuKeyListener.class);
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:4,代码来源:JMenuItem.java

示例14: addMenuKeyListener

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public void addMenuKeyListener(MenuKeyListener l) {
	list.add(MenuKeyListener.class, l);
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:4,代码来源:JPopupMenu.java

示例15: removeMenuKeyListener

import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public void removeMenuKeyListener(MenuKeyListener l) {
	list.remove(MenuKeyListener.class, l);
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:4,代码来源:JPopupMenu.java


注:本文中的javax.swing.event.MenuKeyListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。