6888634: test/closed/javax/swing/Popup/TaskbarPositionTest.java fails
Reviewed-by: alexp
--- 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;