This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gui] [PATCH] Fix BorderLayout's layoutContainer() method
- From: David Jee <djee at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Wed, 26 May 2004 15:28:18 -0400
- Subject: [gui] [PATCH] Fix BorderLayout's layoutContainer() method
Hello,
I committed the following patch to the java-gui-branch. It fixes
BorderLayout's layoutContainer() method, so that the size calculations
are always correct.
-David Jee
2004-05-26 David Jee <djee@redhat.com>
* java/awt/BorderLayout.java
(layoutContainer): Fix size calculations.
Index: java/awt/BorderLayout.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/BorderLayout.java,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 BorderLayout.java
--- java/awt/BorderLayout.java 26 Feb 2004 19:16:44 -0000 1.12.2.1
+++ java/awt/BorderLayout.java 26 May 2004 19:11:48 -0000
@@ -592,13 +592,21 @@
int x1 = i.left;
int x2 = x1 + w.width + hgap;
- int x3 = Math.max(x2 + w.width + hgap, t.width - i.right - e.width);
+ int x3;
+ if (t.width <= i.right + e.width)
+ x3 = x2 + w.width + 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 midh = Math.max(e.height, Math.max(w.height, c.height));
- int y3 = Math.max(y2 + midh + vgap, t.height - i.bottom - s.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;
setBounds(center, x2, y2, x3-x2-hgap, hh);