6857360: NimbusLAF: Menu indicator looks ugly with RTL orientation.
authorpeterz
Mon, 20 Jul 2009 13:33:09 +0400
changeset 3343 54d3dddd301f
parent 3342 fc3326a698e3
child 3344 e2acdc658d52
6857360: NimbusLAF: Menu indicator looks ugly with RTL orientation. Reviewed-by: rupashka
jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java
jdk/src/share/classes/sun/swing/MenuItemLayoutHelper.java
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java	Fri Jul 17 15:25:51 2009 +0400
+++ b/jdk/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/jdk/src/share/classes/sun/swing/MenuItemLayoutHelper.java	Fri Jul 17 15:25:51 2009 +0400
+++ b/jdk/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) {