HI,
an app written by me years ago demonstrates that MatteBorder can accept a null
tileIcon. Classpath' implementation throw an exception in that case. The
attached patch fixes that and make the paintBorder method aware of a possibly
null tileIcon.

ChangeLog:

2006-06-08  Robert Schuster  <[EMAIL PROTECTED]>

        * javax/swing/border/MatteBorder.java:
        (MatteBorder(int,int,int,int,Icon)): Removed if-statement and exception
        throwing.
        (paintBorder): Added if-statement to abort painting early.

cya
Robert
Index: javax/swing/border/MatteBorder.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/border/MatteBorder.java,v
retrieving revision 1.11
diff -u -r1.11 MatteBorder.java
--- javax/swing/border/MatteBorder.java	21 Apr 2006 11:26:33 -0000	1.11
+++ javax/swing/border/MatteBorder.java	8 Jun 2006 10:45:11 -0000
@@ -1,5 +1,5 @@
 /* MatteBorder.java -- 
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -147,9 +147,6 @@
   {
     super(top, left, bottom, right);
 
-    if (tileIcon == null)
-      throw new IllegalArgumentException();
-
     this.tileIcon = tileIcon;
   }
 
@@ -375,6 +372,10 @@
       }
       return;
     }
+    
+    // If this border has no icon end painting here.
+    if (tileIcon == null)
+      return;
 
     /* Determine the width and height of the icon. Some icons return
      * -1 if it is an image whose dimensions have not yet been

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to