Java Code Examples for javax.swing.event.MenuKeyEvent#getKeyCode()

The following examples show how to use javax.swing.event.MenuKeyEvent#getKeyCode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FreeColAction.java    From freecol with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void menuKeyPressed(MenuKeyEvent e) {

    if (e.getKeyCode() == mnemonic) {
        ActionEvent ae = new ActionEvent(e.getSource(), e.getID(),
                                         (String) getValue(Action.NAME),
                                         e.getModifiersEx());
        actionPerformed(ae);

        e.consume();
    }
}
 
Example 2
Source File: WtPopupMenu.java    From stendhal with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void processMenuKeyEvent(final MenuKeyEvent ev) {
	switch (ev.getKeyCode()) {
	case KeyEvent.VK_ESCAPE:
		break;

	default:
		redirectEvent(ev);
	}

	if (!ev.isConsumed()) {
		super.processMenuKeyEvent(ev);
	}
}