Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4410329

Focus issue with pull down and pop up menus

XMLWordPrintable

    • beta
    • x86
    • windows_nt
    • Verified

      JPopup and JMenu* do not work properly with the keyboard.
        JPopup does not work with the keyboard (arrow keys, enter key, etc.). We had to implement a work around in a derived class.
      Enter key is not always processed by JMenu.
        We have cases where we are doing the following on an instance of JPanel:
          // Add the search action to the action map for the filter panel.
          // This will effectively make the search button behave as the default button.
          KeyStroke enterKS = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
          getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(enterKS, searchAction);
          getActionMap().put(searchAction, searchAction);
        If we go to the menu from this panel and press enter on a menu item the searchAction is performed rather than the selecting the current item in the menu.

          Attached is an example which demonstrates the problems. The header
      comment in the source file reviews the specific problems.

            mdavidsosunw Mark Davidson (Inactive)
            mimiali Mir Ali (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: