This patch fixes the strange size reduction seen in Robert Schuster's
license chooser program and reported to bug-classpath.

This patch essentially removes the horizontal and vertical padding of
components when there is no adjacent component.  The problem involved
JRootPane being resized everytime its JLayeredPane was resized: the
JLayeredPane would be set to the full size of the JRootPane only to have
the JRootPane be reduced in size due to this padding issue.

This patch needs approval, especially since it involves an AWT layout
manager rather than my normal swing widgets.

Patch is attached.

2005-07-20  Anthony Balkissoon  <[EMAIL PROTECTED]>

* java/awt/BorderLayout.java:
(layoutContainer): Removed addition of horizontal and vertical gaps
when there is no corresponding adjacent component.
Index: java/awt/BorderLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/BorderLayout.java,v
retrieving revision 1.15
diff -u -r1.15 BorderLayout.java
--- java/awt/BorderLayout.java	2 Jul 2005 20:32:23 -0000	1.15
+++ java/awt/BorderLayout.java	20 Jul 2005 15:02:21 -0000
@@ -591,25 +591,25 @@
       */
 
       int x1 = i.left;
-      int x2 = x1 + w.width + hgap;
+      int x2 = x1 + w.width + (w.width == 0 ? 0 : hgap);
       int x3;
       if (t.width <= i.right + e.width)
-        x3 = x2 + w.width + hgap;
+        x3 = x2 + w.width + (w.width == 0 ? 0 : hgap);
       else
         x3 = t.width - i.right - e.width;
       int ww = t.width - i.right - i.left;
 
       int y1 = i.top;
-      int y2 = y1 + n.height + vgap;
+      int y2 = y1 + n.height + (n.height == 0 ? 0 : vgap);
       int midh = Math.max(e.height, Math.max(w.height, c.height));
       int y3;
       if (t.height <= i.bottom + s.height)
         y3 = y2 + midh + vgap;
       else
         y3 = t.height - i.bottom - s.height;
-      int hh = y3-y2-vgap;
+      int hh = y3-y2-(s.height == 0 ? 0 : vgap);
 
-      setBounds(center, x2, y2, x3-x2-hgap, hh);
+      setBounds(center, x2, y2, x3-x2-(w.width == 0 ? 0 : hgap), hh);
       setBounds(my_north, x1, y1, ww, n.height);
       setBounds(my_south, x1, y3, ww, s.height);
       setBounds(my_west, x1, y2, w.width, hh);
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to