changeset 5265:100b6c2f75ba

6888634: test/closed/javax/swing/Popup/TaskbarPositionTest.java fails Reviewed-by: alexp
author rupashka
date Thu, 22 Mar 2012 17:10:48 +0200
parents 9189ec1bb33a
children 1dd6fe680681
files src/share/classes/javax/swing/JPopupMenu.java
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/JPopupMenu.java	Wed Mar 21 17:12:31 2012 +0400
+++ b/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) {
+
+        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;