This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui] [PATCH] FYI: GridBagLayout fix


Here is a small patch to fix a problem with extra space distribution in
GridBagLayout class.  It removes a condition that I had put in earlier,
which was only a temporary solution.  In light of my recent fixes, it is
no longer needed.  I'm committing the patch to the java-gui-branch.

-David Jee

2004-02-16  David Jee  <djee@redhat.com>

        * java/awt/GridBagLayout.java
        (calcCellSizes): Rows or columns with zero sizes should still be
        considered for extra space distribution.


Index: java/awt/GridBagLayout.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/GridBagLayout.java,v
retrieving revision 1.8.2.1
diff -u -r1.8.2.1 GridBagLayout.java
--- java/awt/GridBagLayout.java	13 Feb 2004 23:16:09 -0000	1.8.2.1
+++ java/awt/GridBagLayout.java	16 Feb 2004 17:25:33 -0000
@@ -976,13 +976,6 @@
       int totalSize = sumIntArray (sizes);
       double totalWeight = sumDoubleArray (weights);
 
-      // Rows or columns with size 0 should not be weighted in the calculation.
-      for (int i = 0; i < weights.length; i++)
-        {
-          if (sizes[i] == 0)
-            totalWeight -= weights[i];
-        }
-
       int diff = range - totalSize;
 
       if (diff == 0)
@@ -990,14 +983,10 @@
 
       for (int i = 0; i < sizes.length; i++)
         {
-          // A row or column with zero size cannot all of a sudden gain size.
-          if (sizes[i] != 0.0)
-            {
-              int newsize = (int) (sizes[i] + (((double) diff) * weights [i] / totalWeight ));
+          int newsize = (int) (sizes[i] + (((double) diff) * weights [i] / totalWeight ));
 
-              if (newsize > 0)
-                sizes[i] = newsize;
-            }
+          if (newsize > 0)
+            sizes[i] = newsize;
         }
     }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]