Java 类javax.swing.MenuSelectionManager 实例源码

项目:incubator-netbeans    文件:StayOpenPopupMenu.java   
public void processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager) {
    if (isReturnAction(e)) { // Handle SPACE and ENTER
        MenuElement[] p = manager.getSelectedPath();
        MenuElement m = p != null && p.length > 0 ? p[p.length - 1] : null;
        if (m instanceof StayOpen) {
            e.consume();
            if (e.getID() == KeyEvent.KEY_PRESSED)
                performAction((StayOpen)m, e.getModifiers());
            return;
        }
    } else for (Component component : getComponents()) { // Handle mnemonics and accelerators
        if (component instanceof StayOpen) {
            StayOpen item = (StayOpen)component;
            JMenuItem i = item.getItem();
            KeyStroke k = KeyStroke.getKeyStrokeForEvent(e);
            if (k.equals(mnemonic(i)) || k.equals(i.getAccelerator())) {
                e.consume();
                manager.setSelectedPath(new MenuElement[] { this, i });
                performAction(item, e.getModifiers());
                return;
            }
        }
    }

    super.processKeyEvent(e, path, manager);
}
项目:marathonv5    文件:JMenuItemJavaElementTest.java   
@BeforeMethod public void showDialog() throws Throwable {
    JavaElementFactory.add(JMenuItem.class, JMenuItemJavaElement.class);
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame(JMenuItemJavaElementTest.class.getSimpleName());
            frame.setName("frame-" + JMenuItemJavaElementTest.class.getSimpleName());
            MenuDemo demo = new MenuDemo();
            frame.setJMenuBar(demo.createMenuBar());
            frame.setContentPane(demo.createContentPane());
            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });
    MenuSelectionManager.defaultManager().clearSelectedPath();
    driver = new JavaAgent();
    menus = driver.findElementsByTagName("menu");
    AMenu = menus.get(0);

}
项目:marathonv5    文件:JMenuItemJavaElement2Test.java   
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame(JMenuItemJavaElement2Test.class.getSimpleName());
            frame.setName("frame-" + JMenuItemJavaElement2Test.class.getSimpleName());
            PopupMenuDemoX demo = new PopupMenuDemoX();
            frame.setJMenuBar(demo.createMenuBar());
            frame.setContentPane(demo.createContentPane());

            // Create and set up the popup menu.
            demo.createPopupMenu();

            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });
    MenuSelectionManager.defaultManager().clearSelectedPath();
    JavaElementFactory.add(JMenuItem.class, JMenuItemJavaElement.class);
}
项目:marathonv5    文件:JPopupMenuTest.java   
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame(JPopupMenuTest.class.getSimpleName());
            frame.setName("frame-" + JPopupMenuTest.class.getSimpleName());
            PopupMenuDemo demo = new PopupMenuDemo();
            frame.setJMenuBar(demo.createMenuBar());
            frame.setContentPane(demo.createContentPane());

            // Create and set up the popup menu.
            demo.createPopupMenu();

            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });
    MenuSelectionManager.defaultManager().clearSelectedPath();
}
项目:openjdk-jdk10    文件:JPopupMenuEndlessLoopTest.java   
public static void main(String[] args) throws Exception {
    SwingUtilities.invokeAndWait(() -> {

        JPopupMenu popup = new JPopupMenu("Popup Menu");
        JMenu menu = new JMenu("Menu");
        menu.add(new JMenuItem("Menu Item"));
        popup.add(menu);
        menu.doClick();
        MenuElement[] elems = MenuSelectionManager
                .defaultManager().getSelectedPath();

        if (elems == null || elems.length == 0) {
            throw new RuntimeException("Empty Selection");
        }

        if (elems[0] != popup || elems[1] != menu) {
            throw new RuntimeException("Necessary menus are not selected!");
        }
    });
}
项目:openjdk9    文件:JPopupMenuEndlessLoopTest.java   
public static void main(String[] args) throws Exception {
    SwingUtilities.invokeAndWait(() -> {

        JPopupMenu popup = new JPopupMenu("Popup Menu");
        JMenu menu = new JMenu("Menu");
        menu.add(new JMenuItem("Menu Item"));
        popup.add(menu);
        menu.doClick();
        MenuElement[] elems = MenuSelectionManager
                .defaultManager().getSelectedPath();

        if (elems == null || elems.length == 0) {
            throw new RuntimeException("Empty Selection");
        }

        if (elems[0] != popup || elems[1] != menu) {
            throw new RuntimeException("Necessary menus are not selected!");
        }
    });
}
项目:javify    文件:BasicComboPopup.java   
/**
 * This method hides drop down list of items
 */
public void hide()
{
  MenuSelectionManager menuSelectionManager =
    MenuSelectionManager.defaultManager();
  javax.swing.MenuElement[] menuElements =
    menuSelectionManager.getSelectedPath();
  for (int i = 0; i < menuElements.length; i++)
    {
      if (menuElements[i] == this)
        {
          menuSelectionManager.clearSelectedPath();
          break;
        }
    }
  comboBox.repaint();
}
项目:javify    文件:BasicMenuBarUI.java   
/**
 * Performs the action.
 */
public void actionPerformed(ActionEvent event)
{
  // In the JDK this action seems to pop up the first menu of the
  // menu bar.
  JMenuBar menuBar = (JMenuBar) event.getSource();
  MenuSelectionManager defaultManager =
    MenuSelectionManager.defaultManager();
  MenuElement me[];
  MenuElement subElements[];
  JMenu menu = menuBar.getMenu(0);
  if (menu != null)
    {
      me = new MenuElement[3];
      me[0] = (MenuElement) menuBar;
      me[1] = (MenuElement) menu;
      me[2] = (MenuElement) menu.getPopupMenu();
      defaultManager.setSelectedPath(me);
    }
}
项目:javify    文件:BasicPopupMenuUI.java   
/**
 * Installs and initializes all fields for this UI delegate. Any properties
 * of the UI that need to be initialized and/or set to defaults will be
 * done now. It will also install any listeners necessary.
 *
 * @param c The {@link JComponent} that is having this UI installed.
 */
public void installUI(JComponent c)
{
  super.installUI(c);

  // Install KeyboardHelper when the first popup is initialized.
  if (numPopups == 0)
    {
      keyboardHelper = new KeyboardHelper();
      MenuSelectionManager msm = MenuSelectionManager.defaultManager();
      msm.addChangeListener(keyboardHelper);
    }
  numPopups++;

  popupMenu = (JPopupMenu) c;
  popupMenu.setLayout(new DefaultMenuLayout(popupMenu, BoxLayout.Y_AXIS));
  popupMenu.setBorderPainted(true);
  JPopupMenu.setDefaultLightWeightPopupEnabled(true);

  installDefaults();
  installListeners();
  installKeyboardActions();
}
项目:javify    文件:BasicPopupMenuUI.java   
/**
 * Performs the opposite of installUI. Any properties or resources that need
 * to be cleaned up will be done now. It will also uninstall any listeners
 * it has. In addition, any properties of this UI will be nulled.
 *
 * @param c The {@link JComponent} that is having this UI uninstalled.
 */
public void uninstallUI(JComponent c)
{
  uninstallListeners();
  uninstallDefaults();
  uninstallKeyboardActions();
  popupMenu = null;

  // Install KeyboardHelper when the first popup is initialized.
  numPopups--;
  if (numPopups == 0)
    {
      MenuSelectionManager msm = MenuSelectionManager.defaultManager();
      msm.removeChangeListener(keyboardHelper);
    }

}
项目:incubator-netbeans    文件:HelpAction.java   
@Override public void actionPerformed(ActionEvent ev) {
    Help h = (Help)Lookup.getDefault().lookup(Help.class);
    if (h == null) {
        Toolkit.getDefaultToolkit().beep();
        return;
    }

    HelpCtx help;

    final MenuElement[] path =
        MenuSelectionManager.defaultManager().getSelectedPath();

    if (path != null
        && path.length > 0
        && !(path[0].getComponent() instanceof javax.swing.plaf.basic.ComboPopup)
        ) {
        help = HelpCtx.findHelp(path[path.length - 1].getComponent());

        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                MenuElement[] newPath =
                    MenuSelectionManager.defaultManager().getSelectedPath();

                if (newPath.length != path.length)
                    return;
                for (int i = 0; i < newPath.length; i++) {
                    if (newPath[i] != path[i])
                        return;
                }
                MenuSelectionManager.defaultManager().clearSelectedPath();
            }
        });
    }
    else {
        help = findHelpCtx();
    }

    StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(HelpAction.class, "CTL_OpeningHelp"));
    h.showHelp (help);
}
项目:incubator-netbeans    文件:NbPresenter.java   
private void doShow () {
    //#206802 - dialog windows are hidden behind full screen window
    Window fullScreenWindow = null;
    if( Utilities.isUnix() ) {
        GraphicsDevice gd = getGraphicsConfiguration().getDevice();
        if( gd.isFullScreenSupported() ) {
            fullScreenWindow = gd.getFullScreenWindow();
            if( null != fullScreenWindow )
                gd.setFullScreenWindow( null );
        }
    }
    NbPresenter prev = null;
    try {
        MenuSelectionManager.defaultManager().clearSelectedPath();
    } catch( NullPointerException npE ) {
        //#216184
        LOG.log( Level.FINE, null, npE );
    }
    if (isModal()) {
        prev = currentModalDialog;
        currentModalDialog = this;
        fireChangeEvent();
    }

    superShow();

    if( null != fullScreenWindow )
        getGraphicsConfiguration().getDevice().setFullScreenWindow( fullScreenWindow );

    if (currentModalDialog != prev) {
        currentModalDialog = prev;
        fireChangeEvent();
    }
}
项目:incubator-netbeans    文件:AbstractQuickSearchComboBar.java   
/**
 * Show and select menu at a given path. Used to restore a menu after click.
 */
private void showMenuPath(MenuElement[] selectedPath) {
    if (selectedPath != null && selectedPath.length > 1) {
        if (selectedPath[0] instanceof JPopupMenu) {
            ((JPopupMenu) selectedPath[0]).setVisible(true);
            MenuSelectionManager.defaultManager().setSelectedPath(
                    selectedPath);
        }
    }
}
项目:incubator-netbeans    文件:AbstractQuickSearchComboBar.java   
public AllMenuItem(Set<Category> evalCats) {
    this.evalCats = evalCats;
    this.totalCount = ProviderModel.getInstance()
            .getCategories().size();
    getModel().addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            if (isShowing() && model.isArmed()) {
                selectedPath = MenuSelectionManager.defaultManager()
                        .getSelectedPath();
            }
        }
    });
    addActionListener(this);
}
项目:rapidminer    文件:ComboBoxUI.java   
@Override
public void hide() {
    MenuSelectionManager manager = MenuSelectionManager.defaultManager();
    MenuElement[] selection = manager.getSelectedPath();
    for (MenuElement element : selection) {
        if (element == this) {
            manager.clearSelectedPath();
            break;
        }
    }
    ComboBoxUI.this.isDown = false;
    this.comboBox.repaint();
}
项目:marathonv5    文件:JMenuTest.java   
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame(JMenuTest.class.getSimpleName());
            frame.setName("frame-" + JMenuTest.class.getSimpleName());
            MenuDemo demo = new MenuDemo();
            frame.setJMenuBar(demo.createMenuBar());
            frame.setContentPane(demo.createContentPane());
            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });
    MenuSelectionManager.defaultManager().clearSelectedPath();
}
项目:marathonv5    文件:JMenuTest.java   
@AfterMethod public void disposeDriver() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setVisible(false);
            frame.dispose();
        }
    });
    if (driver != null) {
        driver.quit();
    }
    MenuSelectionManager.defaultManager().clearSelectedPath();
}
项目:marathonv5    文件:RMenuItemTest.java   
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            MenuSelectionManager.defaultManager().clearSelectedPath();
            frame = new JFrame(RMenuItemTest.class.getSimpleName());
            frame.setName("frame-" + RMenuItemTest.class.getSimpleName());
            MenuDemo demo = new MenuDemo();
            frame.setJMenuBar(demo.createMenuBar());
            frame.setContentPane(demo.createContentPane());
            frame.pack();
            frame.setVisible(true);
        }
    });
    menus = ComponentUtils.findComponents(JMenu.class, frame);
}
项目:marathonv5    文件:PopupMenuDemoX.java   
public static void main(String[] args) {
    // Schedule a job for the event-dispatching thread:
    // creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    });
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
        @Override public void eventDispatched(AWTEvent event) {
            if (event instanceof MouseEvent && event.getID() == MouseEvent.MOUSE_PRESSED) {
                MenuSelectionManager msm = MenuSelectionManager.defaultManager();
                MenuElement[] selectedPath = msm.getSelectedPath();
                if (selectedPath.length == 0)
                    return;
                MenuElement last = selectedPath[selectedPath.length - 1];
                if (last.getSubElements().length > 0)
                    return;
                StringBuilder sb = new StringBuilder();
                for (MenuElement menu : selectedPath) {
                    Component component = menu.getComponent();
                    sb.append(component.getClass()).append(" ");
                }
                System.out.println(sb);
            }
        }
    }, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK);
}
项目:marathonv5    文件:PopupMenuDemo.java   
public static void main(String[] args) {
    // Schedule a job for the event-dispatching thread:
    // creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    });
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
        @Override public void eventDispatched(AWTEvent event) {
            if (event instanceof MouseEvent && event.getID() == MouseEvent.MOUSE_PRESSED) {
                MenuSelectionManager msm = MenuSelectionManager.defaultManager();
                MenuElement[] selectedPath = msm.getSelectedPath();
                if (selectedPath.length == 0)
                    return;
                MenuElement last = selectedPath[selectedPath.length - 1];
                if (last.getSubElements().length > 0)
                    return;
                StringBuilder sb = new StringBuilder();
                for (MenuElement menu : selectedPath) {
                    Component component = menu.getComponent();
                    sb.append(component.getClass()).append(" ");
                }
                System.out.println(sb);
            }
        }
    }, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK);
}
项目:VASSAL-src    文件:MenuScroller.java   
/**
 * Sets the number of items in the scrolling portion of the menu.
 *
 * @param scrollCount the number of items to display at a time
 * @throws IllegalArgumentException if scrollCount is 0 or negative
 */
public void setScrollCount(int scrollCount) {
  if (scrollCount <= 0) {
    throw new IllegalArgumentException("scrollCount must be greater than 0");
  }
  this.scrollCount = scrollCount;
  MenuSelectionManager.defaultManager().clearSelectedPath();
}
项目:jaer    文件:MenuScroller.java   
/**
 * Sets the number of items in the scrolling portion of the menu.
 * 
 * @param scrollCount the number of items to display at a time
 * @throws IllegalArgumentException if scrollCount is 0 or negative
 */
public void setScrollCount(int scrollCount) {
  if (scrollCount <= 0) {
    throw new IllegalArgumentException("scrollCount must be greater than 0");
  }
  this.scrollCount = scrollCount;
  MenuSelectionManager.defaultManager().clearSelectedPath();
}
项目:OpenJSharp    文件:WindowsRootPaneUI.java   
void altPressed(KeyEvent ev) {
    MenuSelectionManager msm =
        MenuSelectionManager.defaultManager();
    MenuElement[] path = msm.getSelectedPath();
    if (path.length > 0 && ! (path[0] instanceof ComboPopup)) {
        msm.clearSelectedPath();
        menuCanceledOnPress = true;
        ev.consume();
    } else if(path.length > 0) { // We are in ComboBox
        menuCanceledOnPress = false;
        WindowsLookAndFeel.setMnemonicHidden(false);
        WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
        ev.consume();
    } else {
        menuCanceledOnPress = false;
        WindowsLookAndFeel.setMnemonicHidden(false);
        WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
        JMenuBar mbar = root != null ? root.getJMenuBar() : null;
        if(mbar == null && winAncestor instanceof JFrame) {
            mbar = ((JFrame)winAncestor).getJMenuBar();
        }
        JMenu menu = mbar != null ? mbar.getMenu(0) : null;
        if(menu != null) {
            ev.consume();
        }
    }
}
项目:OpenJSharp    文件:WindowsRootPaneUI.java   
public boolean postProcessKeyEvent(KeyEvent ev) {
    if(ev.isConsumed()) {
        // do not manage consumed event
        return false;
    }
    if (ev.getKeyCode() == KeyEvent.VK_ALT) {
        root = SwingUtilities.getRootPane(ev.getComponent());
        winAncestor = (root == null ? null :
                SwingUtilities.getWindowAncestor(root));

        if (ev.getID() == KeyEvent.KEY_PRESSED) {
            if (!altKeyPressed) {
                altPressed(ev);
            }
            altKeyPressed = true;
            return true;
        } else if (ev.getID() == KeyEvent.KEY_RELEASED) {
            if (altKeyPressed) {
                altReleased(ev);
            } else {
                MenuSelectionManager msm =
                    MenuSelectionManager.defaultManager();
                MenuElement[] path = msm.getSelectedPath();
                if (path.length <= 0) {
                    WindowsLookAndFeel.setMnemonicHidden(true);
                    WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
                }
            }
            altKeyPressed = false;
        }
        root = null;
        winAncestor = null;
    } else {
        altKeyPressed = false;
    }
    return false;
}
项目:Cognizant-Intelligent-Test-Scripter    文件:MenuScroller.java   
/**
 * Sets the number of items in the scrolling portion of the menu.
 *
 * @param scrollCount the number of items to display at a time
 * @throws IllegalArgumentException if scrollCount is 0 or negative
 */
public void setScrollCount(int scrollCount) {
    if (scrollCount <= 0) {
        throw new IllegalArgumentException("scrollCount must be greater than 0");
    }
    this.scrollCount = scrollCount;
    MenuSelectionManager.defaultManager().clearSelectedPath();
}
项目:jdk8u-jdk    文件:WindowsRootPaneUI.java   
void altPressed(KeyEvent ev) {
    MenuSelectionManager msm =
        MenuSelectionManager.defaultManager();
    MenuElement[] path = msm.getSelectedPath();
    if (path.length > 0 && ! (path[0] instanceof ComboPopup)) {
        msm.clearSelectedPath();
        menuCanceledOnPress = true;
        ev.consume();
    } else if(path.length > 0) { // We are in ComboBox
        menuCanceledOnPress = false;
        WindowsLookAndFeel.setMnemonicHidden(false);
        WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
        ev.consume();
    } else {
        menuCanceledOnPress = false;
        WindowsLookAndFeel.setMnemonicHidden(false);
        WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
        JMenuBar mbar = root != null ? root.getJMenuBar() : null;
        if(mbar == null && winAncestor instanceof JFrame) {
            mbar = ((JFrame)winAncestor).getJMenuBar();
        }
        JMenu menu = mbar != null ? mbar.getMenu(0) : null;
        if(menu != null) {
            ev.consume();
        }
    }
}
项目:jdk8u-jdk    文件:WindowsRootPaneUI.java   
public boolean postProcessKeyEvent(KeyEvent ev) {
    if(ev.isConsumed() && ev.getKeyCode() != KeyEvent.VK_ALT) {
        // mnemonic combination, it's consumed, but we need
        // set altKeyPressed to false, otherwise after selection
        // component by mnemonic combination a menu will be open
        altKeyPressed = false;
        return false;
    }
    if (ev.getKeyCode() == KeyEvent.VK_ALT) {
        root = SwingUtilities.getRootPane(ev.getComponent());
        winAncestor = (root == null ? null :
                SwingUtilities.getWindowAncestor(root));

        if (ev.getID() == KeyEvent.KEY_PRESSED) {
            if (!altKeyPressed) {
                altPressed(ev);
            }
            altKeyPressed = true;
            return true;
        } else if (ev.getID() == KeyEvent.KEY_RELEASED) {
            if (altKeyPressed) {
                altReleased(ev);
            } else {
                MenuSelectionManager msm =
                    MenuSelectionManager.defaultManager();
                MenuElement[] path = msm.getSelectedPath();
                if (path.length <= 0) {
                    WindowsLookAndFeel.setMnemonicHidden(true);
                    WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
                }
            }
            altKeyPressed = false;
        }
        root = null;
        winAncestor = null;
    } else {
        altKeyPressed = false;
    }
    return false;
}
项目:openjdk-jdk10    文件:WindowsRootPaneUI.java   
void altPressed(KeyEvent ev) {
    MenuSelectionManager msm =
        MenuSelectionManager.defaultManager();
    MenuElement[] path = msm.getSelectedPath();
    if (path.length > 0 && ! (path[0] instanceof ComboPopup)) {
        msm.clearSelectedPath();
        menuCanceledOnPress = true;
        ev.consume();
    } else if(path.length > 0) { // We are in ComboBox
        menuCanceledOnPress = false;
        WindowsLookAndFeel.setMnemonicHidden(false);
        WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
        ev.consume();
    } else {
        menuCanceledOnPress = false;
        WindowsLookAndFeel.setMnemonicHidden(false);
        WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
        JMenuBar mbar = root != null ? root.getJMenuBar() : null;
        if(mbar == null && winAncestor instanceof JFrame) {
            mbar = ((JFrame)winAncestor).getJMenuBar();
        }
        JMenu menu = mbar != null ? mbar.getMenu(0) : null;
        if(menu != null) {
            ev.consume();
        }
    }
}
项目:openjdk-jdk10    文件:JMenuBarOperator.java   
/**
 * Maps
 * {@code JMenuBar.processKeyEvent(KeyEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processKeyEvent(final KeyEvent keyEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processKeyEvent") {
        @Override
        public void map() {
            ((JMenuBar) getSource()).processKeyEvent(keyEvent, menuElement, menuSelectionManager);
        }
    });
}
项目:openjdk-jdk10    文件:JMenuBarOperator.java   
/**
 * Maps
 * {@code JMenuBar.processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processMouseEvent(final MouseEvent mouseEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processMouseEvent") {
        @Override
        public void map() {
            ((JMenuBar) getSource()).processMouseEvent(mouseEvent, menuElement, menuSelectionManager);
        }
    });
}
项目:openjdk-jdk10    文件:JPopupMenuOperator.java   
/**
 * Maps
 * {@code JPopupMenu.processKeyEvent(KeyEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processKeyEvent(final KeyEvent keyEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processKeyEvent") {
        @Override
        public void map() {
            ((JPopupMenu) getSource()).processKeyEvent(keyEvent, menuElement, menuSelectionManager);
        }
    });
}
项目:openjdk-jdk10    文件:JPopupMenuOperator.java   
/**
 * Maps
 * {@code JPopupMenu.processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processMouseEvent(final MouseEvent mouseEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processMouseEvent") {
        @Override
        public void map() {
            ((JPopupMenu) getSource()).processMouseEvent(mouseEvent, menuElement, menuSelectionManager);
        }
    });
}
项目:openjdk-jdk10    文件:JMenuItemOperator.java   
/**
 * Maps
 * {@code JMenuItem.processKeyEvent(KeyEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processKeyEvent(final KeyEvent keyEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processKeyEvent") {
        @Override
        public void map() {
            ((JMenuItem) getSource()).processKeyEvent(keyEvent, menuElement, menuSelectionManager);
        }
    });
}
项目:openjdk-jdk10    文件:JMenuItemOperator.java   
/**
 * Maps
 * {@code JMenuItem.processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processMouseEvent(final MouseEvent mouseEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processMouseEvent") {
        @Override
        public void map() {
            ((JMenuItem) getSource()).processMouseEvent(mouseEvent, menuElement, menuSelectionManager);
        }
    });
}
项目:cloud-meter    文件:MenuScroller.java   
/**
 * Sets the number of items in the scrolling portion of the menu.
 * 
 * @param scrollCount
 *            the number of items to display at a time
 * @throws IllegalArgumentException
 *             if scrollCount is 0 or negative
 */
public void setScrollCount(int scrollCount) {
    if (scrollCount <= 0) {
        throw new IllegalArgumentException(
                "scrollCount must be greater than 0");
    }
    this.scrollCount = scrollCount;
    MenuSelectionManager.defaultManager().clearSelectedPath();
}
项目:openjdk9    文件:JMenuBarOperator.java   
/**
 * Maps
 * {@code JMenuBar.processKeyEvent(KeyEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processKeyEvent(final KeyEvent keyEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processKeyEvent") {
        @Override
        public void map() {
            ((JMenuBar) getSource()).processKeyEvent(keyEvent, menuElement, menuSelectionManager);
        }
    });
}
项目:openjdk9    文件:JMenuBarOperator.java   
/**
 * Maps
 * {@code JMenuBar.processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processMouseEvent(final MouseEvent mouseEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processMouseEvent") {
        @Override
        public void map() {
            ((JMenuBar) getSource()).processMouseEvent(mouseEvent, menuElement, menuSelectionManager);
        }
    });
}
项目:openjdk9    文件:JPopupMenuOperator.java   
/**
 * Maps
 * {@code JPopupMenu.processKeyEvent(KeyEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processKeyEvent(final KeyEvent keyEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processKeyEvent") {
        @Override
        public void map() {
            ((JPopupMenu) getSource()).processKeyEvent(keyEvent, menuElement, menuSelectionManager);
        }
    });
}
项目:openjdk9    文件:JPopupMenuOperator.java   
/**
 * Maps
 * {@code JPopupMenu.processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processMouseEvent(final MouseEvent mouseEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processMouseEvent") {
        @Override
        public void map() {
            ((JPopupMenu) getSource()).processMouseEvent(mouseEvent, menuElement, menuSelectionManager);
        }
    });
}
项目:openjdk9    文件:JMenuItemOperator.java   
/**
 * Maps
 * {@code JMenuItem.processKeyEvent(KeyEvent, MenuElement[], MenuSelectionManager)}
 * through queue
 */
public void processKeyEvent(final KeyEvent keyEvent, final MenuElement[] menuElement, final MenuSelectionManager menuSelectionManager) {
    runMapping(new MapVoidAction("processKeyEvent") {
        @Override
        public void map() {
            ((JMenuItem) getSource()).processKeyEvent(keyEvent, menuElement, menuSelectionManager);
        }
    });
}