javax.swing.event.MenuKeyEvent Java Examples

The following examples show how to use javax.swing.event.MenuKeyEvent. 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: ToolTipManager.java    From dragonwell8_jdk with 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 #2
Source File: ToolTipManager.java    From jdk8u_jdk with 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 File: ToolTipManager.java    From TencentKona-8 with 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 File: ToolTipManager.java    From Bytecoder with 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 File: ToolTipManager.java    From openjdk-jdk8u with 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 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);
	}
}
 
Example #7
Source File: JMenuItemOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 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 #9
Source File: ToolTipManager.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {}
 
Example #10
Source File: ToolTipManager.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {}
 
Example #11
Source File: FreeColAction.java    From freecol with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {
    // do nothing
}
 
Example #12
Source File: FreeColAction.java    From freecol with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {
    // do nothing
}
 
Example #13
Source File: ToolTipManager.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {}
 
Example #14
Source File: ToolTipManager.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {}
 
Example #15
Source File: ToolTipManager.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {}
 
Example #16
Source File: ToolTipManager.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {}
 
Example #17
Source File: ToolTipManager.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {}
 
Example #18
Source File: ToolTipManager.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {}
 
Example #19
Source File: ToolTipManager.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyReleased(MenuKeyEvent e) {}
 
Example #20
Source File: ToolTipManager.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void menuKeyTyped(MenuKeyEvent e) {}