OSDN Git Service

2005-04-19 Roman Kennke <roman@kennke.org>
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Apr 2005 06:36:27 +0000 (06:36 +0000)
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Apr 2005 06:36:27 +0000 (06:36 +0000)
* javax/swing/UIManager.java:
Make the UIManager respect the swing.defaultlaf system
property.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98389 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 6091c6b..fefa1be 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 dfc6a82..dee67d9 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.