Hi,
this patch makes it possible to see the basic look and feel in action in our
Swing demo.

In the future this may help to get customs LaFs working which directly build
upon the Basic Look And Feel.

2006-07-25  Robert Schuster <[EMAIL PROTECTED]>

        * examples/gnu/classpath/examples/swing/Demo.java:
        (mkMenuBar): Install instantiable basic look and feel.
        (InstantiableBasicLookAndFeel): New inner class.

cya
Robert
Index: examples/gnu/classpath/examples/swing/Demo.java
===================================================================
RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/Demo.java,v
retrieving revision 1.48
diff -u -r1.48 Demo.java
--- examples/gnu/classpath/examples/swing/Demo.java	16 Jun 2006 20:46:54 -0000	1.48
+++ examples/gnu/classpath/examples/swing/Demo.java	25 Jul 2006 10:46:40 -0000
@@ -30,6 +30,7 @@
 import javax.swing.*;
 import javax.swing.tree.*;
 
+import javax.swing.plaf.basic.BasicLookAndFeel;
 import javax.swing.plaf.metal.DefaultMetalTheme;
 import javax.swing.plaf.metal.MetalLookAndFeel;
 import javax.swing.plaf.metal.MetalTheme;
@@ -192,6 +193,10 @@
             }
       });
 
+    // Installs the BasicLookAndFeel.
+    UIManager.installLookAndFeel("(Basic Look And Feel)",
+                                 InstantiableBasicLookAndFeel.class.getName());
+    
     // Create L&F menu.
     JMenu lafMenu = new JMenu("Look and Feel");
     ButtonGroup lafGroup = new ButtonGroup();
@@ -662,10 +667,45 @@
         {
           ex.printStackTrace();
         }
+      
       SwingUtilities.updateComponentTreeUI(frame);
       themesMenu.setEnabled(laf.getClassName()
                            .equals("javax.swing.plaf.metal.MetalLookAndFeel"));
     }
+  }
     
+  /**
+   * An implementation of BasicLookAndFeel which can be instantiated.
+   * 
+   * @author Robert Schuster ([EMAIL PROTECTED])
+   *
+   */
+  public static class InstantiableBasicLookAndFeel extends BasicLookAndFeel
+  {
+    public String getDescription()
+    {
+      return "An instantiable implementation of BasicLookAndFeel";
+    }
+    
+    public String getID()
+    { 
+      return "instantiableBasicLookAndFeel";
+    }
+
+    public String getName()
+    {
+      return "Instantiable Basic Look And Feel";
+    }
+    
+    public boolean isNativeLookAndFeel()
+    {
+      return false;
+    }
+    
+    public boolean isSupportedLookAndFeel()
+    {
+      return true;
+    }
   }
+
 }

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to