javax.swing.event.MenuKeyListener Java Examples
The following examples show how to use
javax.swing.event.MenuKeyListener.
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: PopupMenuContainer.java From darklaf with MIT License | 5 votes |
public void setPopupMenu(final JPopupMenu popupMenu) { MenuKeyListener keyListener = getMenuKeyListener(); PopupMenuListener popupMenuListener = getMenuListener(); this.popupMenu = popupMenu; if (popupMenu != null) { popupMenu.removeMenuKeyListener(keyListener); popupMenu.removePopupMenuListener(popupMenuListener); popupMenu.addMenuKeyListener(keyListener); popupMenu.addPopupMenuListener(popupMenuListener); } }
Example #2
Source File: ToolTipManager.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Registers a component for tooltip management. * <p> * This will register key bindings to show and hide the tooltip text * only if <code>component</code> has focus bindings. This is done * so that components that are not normally focus traversable, such * as <code>JLabel</code>, are not made focus traversable as a result * of invoking this method. * * @param component a <code>JComponent</code> object to add * @see JComponent#isFocusTraversable */ public void registerComponent(JComponent component) { component.removeMouseListener(this); component.addMouseListener(this); component.removeMouseMotionListener(moveBeforeEnterListener); component.addMouseMotionListener(moveBeforeEnterListener); // use MenuKeyListener for menu items/elements if (component instanceof JMenuItem) { ((JMenuItem) component).removeMenuKeyListener((MenuKeyListener) accessibilityKeyListener); ((JMenuItem) component).addMenuKeyListener((MenuKeyListener) accessibilityKeyListener); } else { component.removeKeyListener(accessibilityKeyListener); component.addKeyListener(accessibilityKeyListener); } }
Example #3
Source File: ToolTipManager.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Removes a component from tooltip control. * * @param component a <code>JComponent</code> object to remove */ public void unregisterComponent(JComponent component) { component.removeMouseListener(this); component.removeMouseMotionListener(moveBeforeEnterListener); if (component instanceof JMenuItem) { ((JMenuItem) component).removeMenuKeyListener((MenuKeyListener) accessibilityKeyListener); } else { component.removeKeyListener(accessibilityKeyListener); } }
Example #4
Source File: ToolTipManager.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Registers a component for tooltip management. * <p> * This will register key bindings to show and hide the tooltip text * only if <code>component</code> has focus bindings. This is done * so that components that are not normally focus traversable, such * as <code>JLabel</code>, are not made focus traversable as a result * of invoking this method. * * @param component a <code>JComponent</code> object to add * @see JComponent#isFocusTraversable */ public void registerComponent(JComponent component) { component.removeMouseListener(this); component.addMouseListener(this); component.removeMouseMotionListener(moveBeforeEnterListener); component.addMouseMotionListener(moveBeforeEnterListener); // use MenuKeyListener for menu items/elements if (component instanceof JMenuItem) { ((JMenuItem) component).removeMenuKeyListener((MenuKeyListener) accessibilityKeyListener); ((JMenuItem) component).addMenuKeyListener((MenuKeyListener) accessibilityKeyListener); } else { component.removeKeyListener(accessibilityKeyListener); component.addKeyListener(accessibilityKeyListener); } }
Example #5
Source File: ToolTipManager.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Removes a component from tooltip control. * * @param component a <code>JComponent</code> object to remove */ public void unregisterComponent(JComponent component) { component.removeMouseListener(this); component.removeMouseMotionListener(moveBeforeEnterListener); if (component instanceof JMenuItem) { ((JMenuItem) component).removeMenuKeyListener((MenuKeyListener) accessibilityKeyListener); } else { component.removeKeyListener(accessibilityKeyListener); } }
Example #6
Source File: ToolTipManager.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Registers a component for tooltip management. * <p> * This will register key bindings to show and hide the tooltip text * only if <code>component</code> has focus bindings. This is done * so that components that are not normally focus traversable, such * as <code>JLabel</code>, are not made focus traversable as a result * of invoking this method. * * @param component a <code>JComponent</code> object to add * @see JComponent#isFocusTraversable */ public void registerComponent(JComponent component) { component.removeMouseListener(this); component.addMouseListener(this); component.removeMouseMotionListener(moveBeforeEnterListener); component.addMouseMotionListener(moveBeforeEnterListener); // use MenuKeyListener for menu items/elements if (component instanceof JMenuItem) { ((JMenuItem) component).removeMenuKeyListener((MenuKeyListener) accessibilityKeyListener); ((JMenuItem) component).addMenuKeyListener((MenuKeyListener) accessibilityKeyListener); } else { component.removeKeyListener(accessibilityKeyListener); component.addKeyListener(accessibilityKeyListener); } }
Example #7
Source File: ToolTipManager.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Removes a component from tooltip control. * * @param component a <code>JComponent</code> object to remove */ public void unregisterComponent(JComponent component) { component.removeMouseListener(this); component.removeMouseMotionListener(moveBeforeEnterListener); if (component instanceof JMenuItem) { ((JMenuItem) component).removeMenuKeyListener((MenuKeyListener) accessibilityKeyListener); } else { component.removeKeyListener(accessibilityKeyListener); } }
Example #8
Source File: ToolTipManager.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Registers a component for tooltip management. * <p> * This will register key bindings to show and hide the tooltip text * only if <code>component</code> has focus bindings. This is done * so that components that are not normally focus traversable, such * as <code>JLabel</code>, are not made focus traversable as a result * of invoking this method. * * @param component a <code>JComponent</code> object to add * @see JComponent#isFocusTraversable */ public void registerComponent(JComponent component) { component.removeMouseListener(this); component.addMouseListener(this); component.removeMouseMotionListener(moveBeforeEnterListener); component.addMouseMotionListener(moveBeforeEnterListener); // use MenuKeyListener for menu items/elements if (component instanceof JMenuItem) { ((JMenuItem) component).removeMenuKeyListener((MenuKeyListener) accessibilityKeyListener); ((JMenuItem) component).addMenuKeyListener((MenuKeyListener) accessibilityKeyListener); } else { component.removeKeyListener(accessibilityKeyListener); component.addKeyListener(accessibilityKeyListener); } }
Example #9
Source File: ToolTipManager.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Removes a component from tooltip control. * * @param component a <code>JComponent</code> object to remove */ public void unregisterComponent(JComponent component) { component.removeMouseListener(this); component.removeMouseMotionListener(moveBeforeEnterListener); if (component instanceof JMenuItem) { ((JMenuItem) component).removeMenuKeyListener((MenuKeyListener) accessibilityKeyListener); } else { component.removeKeyListener(accessibilityKeyListener); } }
Example #10
Source File: JMenuItemOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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); } }); }
Example #11
Source File: JMenuItemOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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); } }); }
Example #12
Source File: ToolTipManager.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Registers a component for tooltip management. * <p> * This will register key bindings to show and hide the tooltip text * only if <code>component</code> has focus bindings. This is done * so that components that are not normally focus traversable, such * as <code>JLabel</code>, are not made focus traversable as a result * of invoking this method. * * @param component a <code>JComponent</code> object to add * @see JComponent#isFocusTraversable */ public void registerComponent(JComponent component) { component.removeMouseListener(this); component.addMouseListener(this); component.removeMouseMotionListener(moveBeforeEnterListener); component.addMouseMotionListener(moveBeforeEnterListener); // use MenuKeyListener for menu items/elements if (component instanceof JMenuItem) { ((JMenuItem) component).removeMenuKeyListener((MenuKeyListener) accessibilityKeyListener); ((JMenuItem) component).addMenuKeyListener((MenuKeyListener) accessibilityKeyListener); } else { component.removeKeyListener(accessibilityKeyListener); component.addKeyListener(accessibilityKeyListener); } }
Example #13
Source File: ToolTipManager.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Removes a component from tooltip control. * * @param component a <code>JComponent</code> object to remove */ public void unregisterComponent(JComponent component) { component.removeMouseListener(this); component.removeMouseMotionListener(moveBeforeEnterListener); if (component instanceof JMenuItem) { ((JMenuItem) component).removeMenuKeyListener((MenuKeyListener) accessibilityKeyListener); } else { component.removeKeyListener(accessibilityKeyListener); } }
Example #14
Source File: FreeColAction.java From freecol with GNU General Public License v2.0 | 4 votes |
public MenuKeyListener getMenuKeyListener() { return new InnerMenuKeyListener(); }