类javax.swing.event.MenuKeyListener源码实例Demo

下面列出了怎么用javax.swing.event.MenuKeyListener的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: darklaf   文件: PopupMenuContainer.java
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);
    }
}
 
源代码2 项目: dragonwell8_jdk   文件: ToolTipManager.java
/**
 * 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);
    }
}
 
源代码3 项目: dragonwell8_jdk   文件: ToolTipManager.java
/**
 * 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);
    }
}
 
源代码4 项目: TencentKona-8   文件: ToolTipManager.java
/**
 * 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);
    }
}
 
源代码5 项目: TencentKona-8   文件: ToolTipManager.java
/**
 * 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);
    }
}
 
源代码6 项目: openjdk-jdk8u   文件: ToolTipManager.java
/**
 * 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);
    }
}
 
源代码7 项目: openjdk-jdk8u   文件: ToolTipManager.java
/**
 * 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);
    }
}
 
源代码8 项目: Bytecoder   文件: ToolTipManager.java
/**
 * 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);
    }
}
 
源代码9 项目: Bytecoder   文件: ToolTipManager.java
/**
 * 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);
    }
}
 
源代码10 项目: openjdk-jdk9   文件: JMenuItemOperator.java
/**
 * 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);
        }
    });
}
 
源代码11 项目: openjdk-jdk9   文件: JMenuItemOperator.java
/**
 * 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);
        }
    });
}
 
源代码12 项目: jdk8u_jdk   文件: ToolTipManager.java
/**
 * 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);
    }
}
 
源代码13 项目: jdk8u_jdk   文件: ToolTipManager.java
/**
 * 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);
    }
}
 
源代码14 项目: freecol   文件: FreeColAction.java
public MenuKeyListener getMenuKeyListener() {
    return new InnerMenuKeyListener();
}
 
 类所在包
 同包方法