6888634: test/closed/javax/swing/Popup/TaskbarPositionTest.java fails
authorrupashka
Thu, 22 Mar 2012 17:10:48 +0200
changeset 12278 f3519c549711
parent 12178 6b681d75ebe5
child 12279 a88bb2d86435
6888634: test/closed/javax/swing/Popup/TaskbarPositionTest.java fails Reviewed-by: alexp
jdk/src/share/classes/javax/swing/JPopupMenu.java
--- a/jdk/src/share/classes/javax/swing/JPopupMenu.java	Wed Mar 21 17:12:31 2012 +0400
+++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java	Thu Mar 22 17:10:48 2012 +0200
@@ -359,17 +359,20 @@
         int scrBottomY = scrBounds.y + scrHeight;
 
         // Ensure that popup menu fits the screen
-        if (popupRightX > (long)scrRightX) {
+        if (popupRightX > (long) scrRightX) {
             popupLocation.x = scrRightX - popupSize.width;
-            if( popupLocation.x < scrBounds.x ) {
-                popupLocation.x = scrBounds.x ;
-            }
+        }
+
+        if (popupBottomY > (long) scrBottomY) {
+            popupLocation.y = scrBottomY - popupSize.height;
         }
-        if (popupBottomY > (long)scrBottomY) {
-            popupLocation.y = scrBottomY - popupSize.height;
-            if( popupLocation.y < scrBounds.y ) {
-                popupLocation.y = scrBounds.y;
-            }
+
+        if (popupLocation.x < scrBounds.x) {
+            popupLocation.x = scrBounds.x;
+        }
+
+        if (popupLocation.y < scrBounds.y) {
+            popupLocation.y = scrBounds.y;
         }
 
         return popupLocation;