changeset 1739:6115613a3386

6857888: closed/javax/swing/JMenuItem/6458123/bug6458123.java fails with InvocationTargetException. Reviewed-by: alexp
author peterz
date Wed, 23 Sep 2009 21:14:53 +0400
parents 9d78c3d9def2
children d5045dd60c29
files src/share/classes/javax/swing/plaf/nimbus/skin.laf src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/plaf/nimbus/skin.laf	Mon Sep 21 17:58:09 2009 +0400
+++ b/src/share/classes/javax/swing/plaf/nimbus/skin.laf	Wed Sep 23 21:14:53 2009 +0400
@@ -14824,7 +14824,9 @@
             <background/>
             <cacheSettingsInherited>false</cacheSettingsInherited>
             <cacheMode>NO_CACHING</cacheMode>
-            <uiproperties/>
+            <uiproperties>
+               <uiProperty name="textIconGap" type="INT" value="5"/>
+            </uiproperties>
          </style>
          <backgroundStates>
             <state stateKeys="Disabled">
--- a/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java	Mon Sep 21 17:58:09 2009 +0400
+++ b/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java	Wed Sep 23 21:14:53 2009 +0400
@@ -475,11 +475,11 @@
          return result;
      }
 
-    static void applyInsets(Rectangle rect, Insets insets) {
+    static void applyInsets(Rectangle rect, Insets insets, boolean leftToRight) {
         if (insets != null) {
-            rect.x += insets.left;
+            rect.x += (leftToRight ? insets.left : insets.right);
             rect.y += insets.top;
-            rect.width -= (insets.right + rect.x);
+            rect.width -= (leftToRight ? insets.right : insets.left) + rect.x;
             rect.height -= (insets.bottom + rect.y);
         }
     }
@@ -492,12 +492,12 @@
         g.setFont(style.getFont(context));
 
         Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight());
-        applyInsets(viewRect, mi.getInsets());
+        boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi);
+        applyInsets(viewRect, mi.getInsets(), leftToRight);
 
         SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper(
-                context, accContext, mi, checkIcon,
-                arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter,
-                SynthLookAndFeel.isLeftToRight(mi),
+                context, accContext, mi, checkIcon, arrowIcon, viewRect,
+                defaultTextIconGap, acceleratorDelimiter, leftToRight,
                 MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix);
         MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem();