JDK-4223393 : menu item hidden behind applet warning message
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0,1.3.0,1.3.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,windows_nt
  • CPU: generic,x86
  • Submitted: 1999-03-24
  • Updated: 2001-05-09
  • Resolved: 2001-05-09
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
1.4.0 beta2Fixed
Related Reports
Duplicate :  
Duplicate :  
Description

Name: gsC80088			Date: 03/23/99


If the last menu item of a dropdown menu just happen to overlap the YELLOW applet window warning message, it will go behind it.  

Example code and HTML follows:

import com.sun.java.swing.*;

public class clippedMenu extends JApplet {

	public void init() {
		JFrame f = new JFrame("Clipped menu");

		JMenuBar menuBar = new JMenuBar();
		JMenu menu = new JMenu("Menu 1");

		JMenuItem item1 = new JMenuItem("Item 1");
		menu.add(item1);
		JMenuItem item2 = new JMenuItem("Item 2");
		menu.add(item2);
		JMenuItem item3 = new JMenuItem("Item 3");
		menu.add(item3);

		menuBar.add(menu);

		f.setJMenuBar(menuBar);

		f.pack();
		f.setSize(200,110);
		f.setVisible(true);
	}

	public static void main(String argc[]){
		clippedMenu cm = new clippedMenu();
		cm.init();
	}
}


<html>
<head> 
<title>clipped menu</title>
</head>

<body>

<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.0 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 50 HEIGHT = 50  codebase="http://java.sun.com/products/plugin/1.1/jinstall-11-win32.cab#Version=1,1,0,0">
<PARAM NAME = CODE VALUE = "clippedMenu.class" >
<PARAM NAME = CODEBASE VALUE = "." >

<PARAM NAME="type" VALUE="application/x-java-applet;version=1.1">
<COMMENT>
<EMBED type="application/x-java-applet;version=1.1" java_CODE = "clippedMenu.class" java_CODEBASE = "." WIDTH = 50 HEIGHT = 50   pluginspage="http://java.sun.com/products/plugin/1.1/plugin-install.html"><NOEMBED></COMMENT>

</NOEMBED></EMBED>
</OBJECT>

<!--
<APPLET  CODE = "clippedMenu.class" CODEBASE = "." WIDTH = 50 HEIGHT = 50 >


</APPLET>
-->
<!--"END_CONVERTED_APPLET"-->

</body>
</html>


In this example, "Item 3" will be hidden.  Resizing the window up or down will solve the problem.
(Review ID: 55958) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta2 FIXED IN: merlin-beta2 INTEGRATED IN: merlin-beta2
24-08-2004

WORK AROUND Name: gsC80088 Date: 03/23/99 Obviously making the window a different size will solve the problem but there are multiple dropdown menu, so there is no correct size and my application window is not sizable by user. ======================================================================
24-08-2004

SUGGESTED FIX Name: pzR10082 Date: 11/23/2000 So take insets into account in ContainerPopup.fitsOnScreen(). Alternatively, we could check if popup fits into bounds of the root pane (i.e. parent.getRootPane().getBounds()). The latter approach will result in more compact code, but will fail if parent has no root pane somehow. *** C:\TMP\geta263 Tue Nov 21 16:59:14 2000 --- PopupFactory.java Tue Nov 21 16:55:00 2000 *************** *** 425,433 **** if (parent instanceof JFrame || parent instanceof JDialog || parent instanceof JWindow) { return SwingUtilities.isRectangleContainingRectangle( ! parent.getBounds(), new Rectangle(x, y, width, ! height)); } else if (parent instanceof JApplet) { Rectangle r = parent.getBounds(); Point p = parent.getLocationOnScreen(); --- 425,440 ---- if (parent instanceof JFrame || parent instanceof JDialog || parent instanceof JWindow) { + + Rectangle r = parent.getBounds(); + Insets i = parent.getInsets(); + r.x += i.left; + r.y += i.top; + r.width -= (i.left + i.right); + r.height -= (i.top + i.bottom); return SwingUtilities.isRectangleContainingRectangle( ! r, new Rectangle(x, y, width, height)); ! } else if (parent instanceof JApplet) { Rectangle r = parent.getBounds(); Point p = parent.getLocationOnScreen(); ###@###.### 2000-11-22 ======================================================================
22-11-2000

EVALUATION This may because it is the window's bounds rather than the bounds - insets that are check to see whether a menu should be made heavyweight. One workaround would be to request heavyweight menus. Name: pzR10082 Date: 11/23/2000 This is the method PopupFactory.ContainerPopup.fitsOnScreen() which has incorrect logic. It chooses to use light/mediumweight or heavyweight popups based on frame bounds, not taking insets into account. ###@###.### 2000-11-22 ======================================================================
22-11-2000