Java Code Examples for javax.swing.event.MenuKeyEvent#consume()
The following examples show how to use
javax.swing.event.MenuKeyEvent#consume() .
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 |
@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 TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@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 openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@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 |
@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 jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@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: FreeColAction.java From freecol with GNU General Public License v2.0 | 5 votes |
@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(); } }