Java Code Examples for javax.swing.event.MenuKeyEvent

The following examples show how to use javax.swing.event.MenuKeyEvent. These examples are extracted from open source projects. 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
@Override
public void menuKeyPressed(MenuKeyEvent e) {
    if (postTip.equals(KeyStroke.getKeyStrokeForEvent(e))) {
        // get element for the event
        MenuElement path[] = e.getPath();
        MenuElement element = path[path.length - 1];

        // retrieve currently highlighted element
        MenuSelectionManager msm = e.getMenuSelectionManager();
        MenuElement selectedPath[] = msm.getSelectedPath();
        MenuElement selectedElement = selectedPath[selectedPath.length - 1];

        if (element.equals(selectedElement)) {
            // show/hide tooltip message
            JComponent source = (JComponent) element.getComponent();
            ToolTipManager.this.show(source);
            e.consume();
        }
    }
}
 
Example 2
Source Project: TencentKona-8   Source File: ToolTipManager.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void menuKeyPressed(MenuKeyEvent e) {
    if (postTip.equals(KeyStroke.getKeyStrokeForEvent(e))) {
        // get element for the event
        MenuElement path[] = e.getPath();
        MenuElement element = path[path.length - 1];

        // retrieve currently highlighted element
        MenuSelectionManager msm = e.getMenuSelectionManager();
        MenuElement selectedPath[] = msm.getSelectedPath();
        MenuElement selectedElement = selectedPath[selectedPath.length - 1];

        if (element.equals(selectedElement)) {
            // show/hide tooltip message
            JComponent source = (JComponent) element.getComponent();
            ToolTipManager.this.show(source);
            e.consume();
        }
    }
}
 
Example 3
Source Project: openjdk-jdk8u   Source File: ToolTipManager.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void menuKeyPressed(MenuKeyEvent e) {
    if (postTip.equals(KeyStroke.getKeyStrokeForEvent(e))) {
        // get element for the event
        MenuElement path[] = e.getPath();
        MenuElement element = path[path.length - 1];

        // retrieve currently highlighted element
        MenuSelectionManager msm = e.getMenuSelectionManager();
        MenuElement selectedPath[] = msm.getSelectedPath();
        MenuElement selectedElement = selectedPath[selectedPath.length - 1];

        if (element.equals(selectedElement)) {
            // show/hide tooltip message
            JComponent source = (JComponent) element.getComponent();
            ToolTipManager.this.show(source);
            e.consume();
        }
    }
}
 
Example 4
Source Project: Bytecoder   Source File: ToolTipManager.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void menuKeyPressed(MenuKeyEvent e) {
    if (postTip.equals(KeyStroke.getKeyStrokeForEvent(e))) {
        // get element for the event
        MenuElement path[] = e.getPath();
        MenuElement element = path[path.length - 1];

        // retrieve currently highlighted element
        MenuSelectionManager msm = e.getMenuSelectionManager();
        MenuElement selectedPath[] = msm.getSelectedPath();
        MenuElement selectedElement = selectedPath[selectedPath.length - 1];

        if (element.equals(selectedElement)) {
            // show/hide tooltip message
            JComponent source = (JComponent) element.getComponent();
            ToolTipManager.this.show(source);
            e.consume();
        }
    }
}
 
Example 5
Source Project: jdk8u_jdk   Source File: ToolTipManager.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void menuKeyPressed(MenuKeyEvent e) {
    if (postTip.equals(KeyStroke.getKeyStrokeForEvent(e))) {
        // get element for the event
        MenuElement path[] = e.getPath();
        MenuElement element = path[path.length - 1];

        // retrieve currently highlighted element
        MenuSelectionManager msm = e.getMenuSelectionManager();
        MenuElement selectedPath[] = msm.getSelectedPath();
        MenuElement selectedElement = selectedPath[selectedPath.length - 1];

        if (element.equals(selectedElement)) {
            // show/hide tooltip message
            JComponent source = (JComponent) element.getComponent();
            ToolTipManager.this.show(source);
            e.consume();
        }
    }
}
 
Example 6
Source Project: freecol   Source File: FreeColAction.java    License: 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 7
/**
 * Maps {@code JMenuItem.processMenuKeyEvent(MenuKeyEvent)} through queue
 */
public void processMenuKeyEvent(final MenuKeyEvent menuKeyEvent) {
    runMapping(new MapVoidAction("processMenuKeyEvent") {
        @Override
        public void map() {
            ((JMenuItem) getSource()).processMenuKeyEvent(menuKeyEvent);
        }
    });
}
 
Example 8
Source Project: stendhal   Source File: WtPopupMenu.java    License: 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);
	}
}
 
Example 9
@Override
public void menuKeyTyped(MenuKeyEvent e) {}
 
Example 10
@Override
public void menuKeyReleased(MenuKeyEvent e) {}
 
Example 11
Source Project: TencentKona-8   Source File: ToolTipManager.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {}
 
Example 12
Source Project: TencentKona-8   Source File: ToolTipManager.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {}
 
Example 13
Source Project: openjdk-jdk8u   Source File: ToolTipManager.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {}
 
Example 14
Source Project: openjdk-jdk8u   Source File: ToolTipManager.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {}
 
Example 15
Source Project: freecol   Source File: FreeColAction.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {
    // do nothing
}
 
Example 16
Source Project: freecol   Source File: FreeColAction.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {
    // do nothing
}
 
Example 17
Source Project: Bytecoder   Source File: ToolTipManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {}
 
Example 18
Source Project: Bytecoder   Source File: ToolTipManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {}
 
Example 19
Source Project: jdk8u_jdk   Source File: ToolTipManager.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {}
 
Example 20
Source Project: jdk8u_jdk   Source File: ToolTipManager.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {}