JDK-6180896 : REGRESSION: Popup menus sometimes display empty space at the buttom.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-10-18
  • Updated: 2010-04-02
  • Resolved: 2004-10-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
Popup menus sometimes display empty space at the buttom. The height of the menu rectangle is more than it has to be.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Run two instances of the program below
2) Right mouse click on the first frame to display a menu
3) Right mouse click on the other frame to display a menu
4) Repeat steps 2 and 3 till you see empty space at the buttom of the menu rectangle.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Did not expect you break popup menus
ACTUAL -
Witnessed you break popup menus

REPRODUCIBILITY :
This bug can be reproduced occasionally.

---------- BEGIN SOURCE ----------
  public static void main(String s[])
  {
    // set windows look and feel
    try
    {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Exception exc)
    {
    }
    
    // Workaround to always display mnemonics. XP does not diplay them until Alt is pressed.
    UIManager.put("Button.showMnemonics", Boolean.TRUE);
    
  	final JFrame frame =  new JFrame("Test");
  	frame.setBounds(100, 100, 300, 300);
  	frame.setVisible(true);
  	
    final JPopupMenu popup = new JPopupMenu();
    
    popup.add(new JMenuItem("test 1"));
    popup.addSeparator();
    JCheckBoxMenuItem mi2 = new JCheckBoxMenuItem("test 2");
    mi2.setSelected(true);
    popup.add(mi2);
    popup.addSeparator();
    JMenuItem mi3 = new JMenuItem("test 3");
    mi3.setMnemonic('3');
    mi3.setEnabled(false);
    popup.add(mi3);
    popup.addSeparator();
    popup.add(new JCheckBoxMenuItem("test 4"));
    popup.addSeparator();
    popup.add(new JMenuItem("test 5"));
    popup.addSeparator();
    popup.add(new JMenuItem("test 6"));
    popup.addSeparator();
    popup.add(new JMenuItem("test 7"));
  	
    frame.addMouseListener(new MouseAdapter()
    {
      public void mouseReleased(MouseEvent e)
      {
        if (e.isMetaDown())
        {
          // display popup menu
          popup.show(frame, e.getPoint().x, e.getPoint().y);
        }
      }
    });
  }

---------- END SOURCE ----------

Release Regression From : 1.4.2
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.
###@###.### 10/18/04 23:13 GMT

Comments
EVALUATION Could this be another duplicate of 5089312? ###@###.### 10/19/04 16:21 GMT Absolutely. The same reason and same workaround in the Popup.java fixes this problem. Closing as duplicate. ###@###.### 10/19/04 17:23 GMT
19-10-2004