The 1.5.0 spec states that this method should throw a NullPointerException if the
supplied theme is null:
2005-09-23 David Gilbert <[EMAIL PROTECTED]>
* javax/swing/plaf/metal/MetalLookAndFeel.java
(setCurrentTheme): throw exception if argument is null, improved API
docs.
I also did some investigation of the procedure for changing the theme - this has
been implemented in such a way that it requires setting a new theme then creating
and installing a new instance of the MetalLookAndFeel. It could have been done
better, but that is the way it is and we match the reference implementation. I've
added some comments to the API docs to describe the procedure, since the steps
required are not immediately obvious.
Regards,
Dave
Index: javax/swing/plaf/metal/MetalLookAndFeel.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java,v
retrieving revision 1.59
diff -u -r1.59 MetalLookAndFeel.java
--- javax/swing/plaf/metal/MetalLookAndFeel.java 22 Sep 2005 17:31:30
-0000 1.59
+++ javax/swing/plaf/metal/MetalLookAndFeel.java 23 Sep 2005 08:22:00
-0000
@@ -42,7 +42,9 @@
import java.awt.Font;
import java.awt.Insets;
+import javax.swing.LookAndFeel;
import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
@@ -602,12 +604,21 @@
}
/**
- * Sets the current theme for the look and feel.
+ * Sets the current theme for the look and feel. Note that the theme must
be
+ * set <em>before</em> the look and feel is installed. To change the theme
+ * for an already running application that is using the
+ * [EMAIL PROTECTED] MetalLookAndFeel}, first set the theme with this
method, then
+ * create a new instance of [EMAIL PROTECTED] MetalLookAndFeel} and install
it in the
+ * usual way (see [EMAIL PROTECTED] UIManager#setLookAndFeel(LookAndFeel)}).
*
- * @param theme the theme.
+ * @param theme the theme (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if <code>theme</code> is <code>null</code>.
*/
public static void setCurrentTheme(MetalTheme theme)
{
+ if (theme == null)
+ throw new NullPointerException("Null 'theme' not permitted.");
MetalLookAndFeel.theme = theme;
}
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches