UIManager.java: Make the UIManager respect the swing.defaultlaf system property.
authorRoman Kennke <roman@kennke.org>
Tue, 19 Apr 2005 06:36:27 +0000 (06:36 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Tue, 19 Apr 2005 06:36:27 +0000 (06:36 +0000)
2005-04-19  Roman Kennke  <roman@kennke.org>

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

From-SVN: r98389

libjava/ChangeLog
libjava/javax/swing/UIManager.java

index 6091c6bb210c269e91f0a70947bed2684b5a4989..fefa1be073210bfac803ad495dcf9a5586ca02d3 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-19  Roman Kennke  <roman@kennke.org>
+
+       * javax/swing/UIManager.java:
+       Make the UIManager respect the swing.defaultlaf system
+       property.
+
 2005-04-19  Tom Tromey  <tromey@redhat.com>
 
        * java/lang/natVMClassLoader.cc (loadClass): Call resolveClass,
index dfc6a82ac463b5a26d1a9f6e8dd14cbd05a0a4f1..dee67d9762eebd08a77f19acfcb2ee181365510d 100644 (file)
@@ -83,7 +83,26 @@ public class UIManager implements Serializable
   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.