[Patch] javax.swing.UIManager

Michael Koch konqueror@gmx.de
Tue Apr 19 06:38:00 GMT 2005


Hi list,


I just commited the attached patch to merge it from GNU classpath to
HEAD.


Michael


2005-04-19  Roman Kennke  <roman@kennke.org>

	* javax/swing/UIManager.java:
	Make the UIManager respect the swing.defaultlaf system
	property.

-------------- next part --------------
Index: javax/swing/UIManager.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/UIManager.java,v
retrieving revision 1.13
diff -u -r1.13 UIManager.java
--- javax/swing/UIManager.java	16 Feb 2005 20:02:43 -0000	1.13
+++ javax/swing/UIManager.java	19 Apr 2005 06:33:05 -0000
@@ -83,7 +83,26 @@
   static LookAndFeel[] aux_installed;
   
   static LookAndFeel look_and_feel = new MetalLookAndFeel();
-    
+
+  static
+  {
+    String defaultlaf = System.getProperty("swing.defaultlaf");
+    try {
+      if (defaultlaf != null)
+        {
+          Class lafClass = Class.forName(defaultlaf);
+          LookAndFeel laf = (LookAndFeel) lafClass.newInstance();
+          setLookAndFeel(laf);
+        }
+    }
+    catch (Exception ex)
+      {
+        System.err.println("cannot initialize Look and Feel: " + defaultlaf);
+        System.err.println("errot: " + ex.getMessage());
+        System.err.println("falling back to Metal Look and Feel");
+      }
+  }
+
   public UIManager()
   {
     // Do nothing here.


More information about the Java-patches mailing list