This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui][PATCH] Corrected location of heavyweight popup menu


Hi,

Here is just a small patch that fixes location of a 
HeavyWeight popup menu.

I'll be committing this patch to java-gui-branch.

Olga.
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2660.2.180
diff -c -p -u -r1.2660.2.180 ChangeLog
--- ChangeLog	14 Jun 2004 14:26:52 -0000	1.2660.2.180
+++ ChangeLog	14 Jun 2004 16:38:16 -0000
@@ -1,5 +1,11 @@
 2004-06-14  Olga Rodimina  <rodimina@redhat.com>
 
+	* javax/swing/JPopupMenu.java:
+	(setVisible): Corrected location of a 
+	heavyweight popup menu.
+
+2004-06-14  Olga Rodimina  <rodimina@redhat.com>
+
 	* javax/swing/MenuSelectionManager.java: 
 	Ran through jalopy to fix formatting style.
 
Index: javax/swing/JPopupMenu.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JPopupMenu.java,v
retrieving revision 1.3.8.7
diff -c -p -u -r1.3.8.7 JPopupMenu.java
--- javax/swing/JPopupMenu.java	14 Jun 2004 14:16:58 -0000	1.3.8.7
+++ javax/swing/JPopupMenu.java	14 Jun 2004 16:38:16 -0000
@@ -601,8 +601,21 @@ public class JPopupMenu extends JCompone
 		popup.show(p.x, p.y, size.width, size.height);
 	      }
 	    else
-	      popup.show(popupLocation.x, popupLocation.y, size.width,
-	                 size.height);
+	      {
+		// Subtract insets of the top-level container if popup menu's
+		// top-left corner is inside it.
+		if (rootContainer.contains(popupLocation))
+		  {
+		    Insets insets = rootContainer.getInsets();
+		    popup.show(popupLocation.x - insets.left,
+		               popupLocation.y - insets.top, size.width,
+		               size.height);
+		  }
+
+		else
+		  popup.show(popupLocation.x, popupLocation.y, size.width,
+		             size.height);
+	      }
 	  }
 	else
 	  {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]