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

Regression: Pressing Escape key don't close the menu items from jdk7.0 b07 onwards

XMLWordPrintable

    • b07
    • 7
    • b20
    • x86
    • windows_xp
    • Not verified

      I have a frame which contains menus & each menu is having around 50 menu items, which covers the whole screen length. I click on any menu to see the menu items & press escape key, so that menu item gets disappear. I move the mouse pointer to the next menu , I see that next menu's menuitems. I keep the mouse pointer on the menu & try pressing Escape key , the menuitems closes & appears again & again. which is incorrect. This happens only when the mouse pointer is on the second & third menuitem. This is reproducable only in windows xp with windows look and feel. It works fine in jdk6.0 & jdk7.0 till b05 . It fails in jdk7.0 b07 onwards. Hence its a regression.

      Step to reproduce:
      ---------------
      1) Run the attached program.
      2) Maximize the frame.
      3) Click on any menu. you can see the menuitems.
      4) Press the escape key. Observe that menuitems gets disappear.
      5) Move the mouse pointer to the next menu. Observe that you can see menu items.
      6) Press escape key. Observe that menuitems gets disappear & appears again . If you see the same then the bug is reproduce.
      Just a couple of comments:

      To see how menus items appear and disappear you should move mouse to another menu after the step 6 (after pressing the ESCAPE key).

      To reproduce the bug, a test code should set Windows Look and Feel. The attached test case should be modified. There is an example of working code:

      =====Source Begin=====
      import javax.swing.*;

      public class Test{
          private JFrame frame = null;
          private JMenuBar menuBar = null;

          public static void main(String[] args) throws Exception {
              SwingUtilities.invokeAndWait(new Runnable() {
                  public void run() {
                      new Test();
                  }
              });
          }

          public Test() {
              try {
                  UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              } catch (Exception e) {
                  System.err.println(e);
              }

              frame = new JFrame();
              menuBar = new JMenuBar();
              for (int i = 0; i < 10; i++) {
                  JMenu menu = new JMenu("Menu " + i);
                  for (int j = 0; j < 50; j++) {
                      JMenuItem menuItem = new JMenuItem("Item " + i + ", " + j);
                      menu.add(menuItem);
                  }
                  menuBar.add(menu);
              }
              frame.setJMenuBar(menuBar);

              frame.setSize(300, 300);
              frame.setLocationRelativeTo(null);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setVisible(true);
          }
      }
      =====Source End======

            alexp Alexander Potochkin (Inactive)
            lpremkumsunw Lawrence Premkumar1 (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: