This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gui] [PATCH] FYI: Couple AWT fixes
- From: David Jee <djee at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: 26 Feb 2004 14:19:40 -0500
- Subject: [gui] [PATCH] FYI: Couple AWT fixes
- Organization:
Hi.
I committed the following patch to the java-gui-branch. It fixes a
couple small AWT bugs.
-David Jee
2004-02-26 David Jee <djee@redhat.com>
* java/awt/BorderLayout.java
(layoutContainer): Fix width and height calculations to ensure
that they're non-negative.
* java/awt/Component.java
(setBackground): If c is null, inherit from closest ancestor whose
background color is set.
Index: java/awt/BorderLayout.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/BorderLayout.java,v
retrieving revision 1.12
diff -u -r1.12 BorderLayout.java
--- java/awt/BorderLayout.java 10 Feb 2004 18:57:22 -0000 1.12
+++ java/awt/BorderLayout.java 26 Feb 2004 19:14:01 -0000
@@ -592,12 +592,13 @@
int x1 = i.left;
int x2 = x1 + w.width + hgap;
- int x3 = t.width - i.right - e.width;
+ int x3 = Math.max(x2 + w.width + hgap, 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 y3 = t.height - i.bottom - s.height;
+ 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 hh = y3-y2-vgap;
setBounds(center, x2, y2, x3-x2-hgap, hh);
Index: java/awt/Component.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Component.java,v
retrieving revision 1.37.2.4
diff -u -r1.37.2.4 Component.java
--- java/awt/Component.java 24 Feb 2004 16:16:52 -0000 1.37.2.4
+++ java/awt/Component.java 26 Feb 2004 19:14:01 -0000
@@ -986,8 +986,11 @@
*/
public void setBackground(Color c)
{
+ // If c is null, inherit from closest ancestor whose bg is set.
+ if (c == null && parent != null)
+ c = parent.getBackground();
firePropertyChange("background", background, c);
- if (peer != null)
+ if (peer != null && c != null)
peer.setBackground(c);
background = c;
}