The button layout stuff must not care about the insets and margin of the
border at the same time, since the margin is already in the insets
through the MarginBorder. Fixed with the attached patch.

2005-04-19  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/plaf/basic/BasicButtonUI.java
        (paint): This should not care about margin and insets
        at the same time, as insets already include the margin
        through the border.
        * javax/swing/plaf/basic/BasicGraphicsUtils.java
        (getPreferredButtonSize): Likewise.
        * javax/swing/plaf/metal/MetalBorders.java
        (getBorderInsets): Likewise.

/Roman

Index: javax/swing/plaf/basic/BasicButtonUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicButtonUI.java,v
retrieving revision 1.17
diff -u -r1.17 BasicButtonUI.java
--- javax/swing/plaf/basic/BasicButtonUI.java	25 Jan 2005 07:07:25 -0000	1.17
+++ javax/swing/plaf/basic/BasicButtonUI.java	19 Apr 2005 07:55:01 -0000
@@ -247,14 +247,12 @@
     Rectangle tr = new Rectangle();
     Rectangle ir = new Rectangle();
     Rectangle vr = new Rectangle();
-    Rectangle br = new Rectangle();
 
     Font f = c.getFont();
 
     g.setFont(f);
 
-    SwingUtilities.calculateInnerArea(b, br);
-    SwingUtilities.calculateInsetArea(br, b.getMargin(), vr);    
+    SwingUtilities.calculateInnerArea(b, vr);
     String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), 
                                                      b.getText(),
                                                      currentIcon(b),
@@ -270,7 +268,7 @@
         || b.isSelected())
       paintButtonPressed(g, b);
     else
-      paintButtonNormal(g, br, c);
+      paintButtonNormal(g, vr, c);
 	
     paintIcon(g, c, ir);
     if (text != null)
Index: javax/swing/plaf/basic/BasicGraphicsUtils.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java,v
retrieving revision 1.11
diff -u -r1.11 BasicGraphicsUtils.java
--- javax/swing/plaf/basic/BasicGraphicsUtils.java	8 Oct 2004 21:41:41 -0000	1.11
+++ javax/swing/plaf/basic/BasicGraphicsUtils.java	19 Apr 2005 07:55:01 -0000
@@ -595,7 +595,6 @@
     Rectangle iconRect = new Rectangle();
     Rectangle textRect = new Rectangle();
     Insets insets = b.getInsets();
-    Insets margin = b.getMargin();
     
     viewRect = new Rectangle();
 
@@ -628,11 +627,11 @@
 
     contentRect = textRect.union(iconRect);
 
-    return new Dimension(insets.left + margin.left
+    return new Dimension(insets.left
 			 + contentRect.width 
-			 + insets.right + margin.right,
-                         insets.top + margin.top
+			 + insets.right,
+                         insets.top
 			 + contentRect.height 
-			 + insets.bottom + margin.bottom);
+			 + insets.bottom);
   }
 }
Index: javax/swing/plaf/metal/MetalBorders.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalBorders.java,v
retrieving revision 1.3
diff -u -r1.3 MetalBorders.java
--- javax/swing/plaf/metal/MetalBorders.java	18 Apr 2005 23:04:36 -0000	1.3
+++ javax/swing/plaf/metal/MetalBorders.java	19 Apr 2005 07:55:01 -0000
@@ -175,7 +175,6 @@
         newInsets = new Insets(0, 0, 0, 0);
 
       AbstractButton b = (AbstractButton) c;
-      Insets margin = b.getMargin();
       newInsets.bottom = borderInsets.bottom;
       newInsets.left = borderInsets.left;
       newInsets.right = borderInsets.right;
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to