jdk/src/share/classes/javax/swing/JPopupMenu.java
changeset 12278 f3519c549711
parent 11268 f0e59c4852de
child 12529 6da056faf511
--- 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;