changeset 1522:4575323d917c

6857360: NimbusLAF: Menu indicator looks ugly with RTL orientation. Reviewed-by: rupashka
author peterz
date Mon, 20 Jul 2009 13:33:09 +0400
parents 59249ab7aa16
children a2114bbf7f3e
files src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java src/share/classes/sun/swing/MenuItemLayoutHelper.java
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java	Fri Jul 17 15:25:51 2009 +0400
+++ b/src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java	Mon Jul 20 13:33:09 2009 +0400
@@ -84,6 +84,8 @@
                         translatex = 1;
                     }
                 }
+            } else if (c instanceof JMenu) {
+                flip = ! c.getComponentOrientation().isLeftToRight();
             }
             if (g instanceof Graphics2D){
                 Graphics2D gfx = (Graphics2D)g;
--- a/src/share/classes/sun/swing/MenuItemLayoutHelper.java	Fri Jul 17 15:25:51 2009 +0400
+++ b/src/share/classes/sun/swing/MenuItemLayoutHelper.java	Mon Jul 20 13:33:09 2009 +0400
@@ -718,10 +718,10 @@
     }
 
     private void alignRect(Rectangle rect, int alignment, int origWidth) {
-        if (alignment != SwingUtilities.LEFT) {
+        if (alignment == SwingConstants.RIGHT) {
             rect.x = rect.x + rect.width - origWidth;
-            rect.width = origWidth;
         }
+        rect.width = origWidth;
     }
 
     protected void layoutIconAndTextInLabelRect(LayoutResult lr) {