classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Some example updates & which LAF should be default?


From: Mark Wielaard
Subject: Re: [cp-patches] Some example updates & which LAF should be default?
Date: Wed, 02 Nov 2005 00:32:40 +0100

Hi,

On Mon, 2005-10-31 at 10:28 +0100, Roman Kennke wrote:
> > I committed this. But should we keep the GNULookAndFeel as default?
> 
> I was also thinking about this and my feeling is that we should use the
> MetalLookAndFeel.

I made Metal the default. And added the option to select the LAF you
want during startup:

2005-11-01  Mark Wielaard  <address@hidden>

        * examples/gnu/classpath/examples/swing/Demo.java (init): Use
        JOptionPane to select the laf if not explicitly set.

Committed,

Mark


? Demo-switches.patch
? DemoJAWT.h
? gnu/classpath/examples/jawt/DemoJAWT$1.class
? gnu/classpath/examples/jawt/DemoJAWT.class
Index: gnu/classpath/examples/swing/Demo.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/Demo.java,v
retrieving revision 1.25
diff -u -r1.25 Demo.java
--- gnu/classpath/examples/swing/Demo.java      30 Oct 2005 22:43:30 -0000      
1.25
+++ gnu/classpath/examples/swing/Demo.java      1 Nov 2005 23:27:01 -0000
@@ -29,6 +29,9 @@
 import javax.swing.tree.*;
 import javax.swing.border.*;
 
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.metal.OceanTheme;
+
 import java.net.URL;
 
 public class Demo
@@ -42,8 +45,6 @@
       {
         if (System.getProperty("swing.defaultlaf") == null)
           {
-            UIManager.setLookAndFeel(new GNULookAndFeel());
-
             StringBuffer text = new StringBuffer();
             text.append("You may change the Look and Feel of this\n");
             text.append("Demo by setting the system property\n");
@@ -58,15 +59,26 @@
             text.append("  the GNU Look and Feel\n");
             text.append("  (derived from 
javax.swing.plaf.basic.BasicLookAndFeel)\n");
            text.append("\n");
-            text.append("the default is 
gnu.classpath.examples.swing.GNULookAndFeel\n");
-            JEditorPane textPane = new JEditorPane();
-            // temporary hack, preferred size should be computed by the
-            // component
-            textPane.setPreferredSize(new Dimension(400, 300));
-            textPane.setText(text.toString());
-            JOptionPane.showMessageDialog(null, textPane,
-                                          "Look and Feel notice",
-                                          JOptionPane.INFORMATION_MESSAGE);
+            text.append("MetalLookAndFeel supports different Themes.\n");
+           text.append("DefaultMetalTheme (the default) and OceanTheme (in 
development)\n");
+
+           final String DEFAULT = "MetalLookAndFeel (default)";
+           final String OCEAN = "MetalLookAndFeel (Ocean)";
+           final String GNU = "GNULookAndFeel";
+           final String[] lafs = new String[] { DEFAULT, OCEAN, GNU };
+
+           int laf = JOptionPane.showOptionDialog(null, text /* textPane */,
+                                                  "Look and Feel choice",
+                                                  JOptionPane.OK_OPTION,
+                                                  JOptionPane.QUESTION_MESSAGE,
+                                                  null, lafs, DEFAULT);
+           if (laf == 1)
+             {
+               MetalLookAndFeel.setCurrentTheme(new OceanTheme());
+             UIManager.setLookAndFeel(new MetalLookAndFeel());
+             }
+           else if (laf == 2)
+             UIManager.setLookAndFeel(new GNULookAndFeel());
           }
       }
     catch (UnsupportedLookAndFeelException e)

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]