本文整理汇总了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);
}
示例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);
}
});
}
示例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);
}
});
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例10: getMenuKeyListener
import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public MenuKeyListener getMenuKeyListener() {
return new InnerMenuKeyListener();
}
示例11: addMenuKeyListener
import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public void addMenuKeyListener(MenuKeyListener l) {
}
示例12: removeMenuKeyListener
import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public void removeMenuKeyListener(MenuKeyListener l) {
}
示例13: getMenuKeyListeners
import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public MenuKeyListener[] getMenuKeyListeners() {
return list.getListeners(MenuKeyListener.class);
}
示例14: addMenuKeyListener
import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public void addMenuKeyListener(MenuKeyListener l) {
list.add(MenuKeyListener.class, l);
}
示例15: removeMenuKeyListener
import javax.swing.event.MenuKeyListener; //导入依赖的package包/类
public void removeMenuKeyListener(MenuKeyListener l) {
list.remove(MenuKeyListener.class, l);
}