/[classpath]/classpath/examples/gnu/classpath/examples/swing/Demo.java
ViewVC logotype

Diff of /classpath/examples/gnu/classpath/examples/swing/Demo.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.9 by gnu_andrew, Tue Sep 20 18:46:22 2005 UTC revision 1.1.2.10 by gnu_andrew, Wed Nov 2 00:43:22 2005 UTC
# Line 24  package gnu.classpath.examples.swing; Line 24  package gnu.classpath.examples.swing;
24    
25  import java.awt.*;  import java.awt.*;
26  import java.awt.event.*;  import java.awt.event.*;
 import java.awt.font.*;  
 import java.awt.geom.*;  
 import java.awt.image.*;  
27    
28  import javax.swing.*;  import javax.swing.*;
 import javax.swing.event.*;  
 import javax.swing.plaf.*;  
 import javax.swing.plaf.basic.*;  
 import javax.swing.plaf.metal.MetalLookAndFeel;  
29  import javax.swing.tree.*;  import javax.swing.tree.*;
30  import javax.swing.border.*;  import javax.swing.border.*;
31    
32  import java.net.URL;  import java.net.URL;
 import java.util.*;  
33    
34  public class Demo  public class Demo
35  {  {
# Line 50  public class Demo Line 42  public class Demo
42        {        {
43          if (System.getProperty("swing.defaultlaf") == null)          if (System.getProperty("swing.defaultlaf") == null)
44            {            {
45                UIManager.setLookAndFeel(new GNULookAndFeel());
46    
47              StringBuffer text = new StringBuffer();              StringBuffer text = new StringBuffer();
48              text.append("\tYou may change the Look and Feel of this\n");              text.append("You may change the Look and Feel of this\n");
49              text.append("\tDemo by setting the system property\n");              text.append("Demo by setting the system property\n");
50              text.append("\t-Dswing.defaultlaf=<LAFClassName>\n\n");              text.append("-Dswing.defaultlaf=<LAFClassName>\n");
51              text.append("\tPossible values for <LAFClassName> are:\n");              text.append("\n");
52              text.append("\t  * javax.swing.plaf.metal.MetalLookAndFeel\n");              text.append("Possible values for <LAFClassName> are:\n");
53              text.append("\t\tthe default Java L&F\n");              text.append("\n");
54              text.append("\t  * gnu.classpath.examples.swing.GNULookAndFeel\n");              text.append("* javax.swing.plaf.metal.MetalLookAndFeel\n");
55              text.append("\tthe GNU Look and Feel\n");              text.append("  the default GNU Classpath L&F\n");
56              text.append("\t(derived from javax.swing.plaf.basic.BasicLookAndFeel\n\n");              text.append("\n");
57              text.append("\tthe default is gnu.classpath.examples.swing.GNULookAndFeel\n");              text.append("* gnu.classpath.examples.swing.GNULookAndFeel\n");
58                text.append("  the GNU Look and Feel\n");
59                text.append("  (derived from javax.swing.plaf.basic.BasicLookAndFeel)\n");
60                text.append("\n");
61                text.append("the default is gnu.classpath.examples.swing.GNULookAndFeel\n");
62              JEditorPane textPane = new JEditorPane();              JEditorPane textPane = new JEditorPane();
63              // temporary hack, preferred size should be computed by the              // temporary hack, preferred size should be computed by the
64              // component              // component
# Line 69  public class Demo Line 67  public class Demo
67              JOptionPane.showMessageDialog(null, textPane,              JOptionPane.showMessageDialog(null, textPane,
68                                            "Look and Feel notice",                                            "Look and Feel notice",
69                                            JOptionPane.INFORMATION_MESSAGE);                                            JOptionPane.INFORMATION_MESSAGE);
               
             UIManager.setLookAndFeel(new GNULookAndFeel());  
70            }            }
71        }        }
72      catch (UnsupportedLookAndFeelException e)      catch (UnsupportedLookAndFeelException e)
# Line 147  public class Demo Line 143  public class Demo
143    
144      JMenu examples = new JMenu("Examples");      JMenu examples = new JMenu("Examples");
145      new PopUpAction("Buttons",      new PopUpAction("Buttons",
146                      mkPanel(new JComponent[]                      (new ButtonDemo("Button Demo")).createContent(),
                         {mkBigButton("mango"),  
                          mkBigButton("guava"),  
                          mkBigButton("lemon")}),  
147                      examples);                      examples);
148            
149      new PopUpAction("Toggles",      new PopUpAction("Toggles",
# Line 181  public class Demo Line 174  public class Demo
174                      examples);                      examples);
175    
176      new PopUpAction("Scrollbar",      new PopUpAction("Scrollbar",
177                      mkScrollBar(),                      (new ScrollBarDemo("ScrollBarDemo")).createContent(),
178                      examples);                      examples);
179    
180      new PopUpAction("Viewport",      new PopUpAction("Viewport",
# Line 189  public class Demo Line 182  public class Demo
182                      examples);                      examples);
183    
184      new PopUpAction("ScrollPane",      new PopUpAction("ScrollPane",
185                      mkScrollPane(mkBigButton("Scroll Me!")),                      mkScrollPane(mkBigButton("Scroll Me!")),
186                      examples);                      examples);
187    
188      new PopUpAction("TabPane",      new PopUpAction("TabPane",
189                      mkTabs(new String[] {"happy",                      mkTabs(new String[] {"happy",
# Line 211  public class Demo Line 204  public class Demo
204                      examples);                      examples);
205    
206      new PopUpAction("ComboBox",      new PopUpAction("ComboBox",
207                      mkComboBox(new String[] {"Stop",                      (new ComboBoxDemo("ComboBox Demo")).createContent(),
                                              "Software",  
                                              "Hoarders",  
                                              "Support",  
                                              "GNU!"}),  
208                      examples);                      examples);
209    
210      new PopUpAction("Editor",      new PopUpAction("Editor",
# Line 317  public class Demo Line 306  public class Demo
306      else      else
307        b = new JButton(title, icon);        b = new JButton(title, icon);
308            
309        b.setToolTipText(title);
310      if (hAlign != -1) b.setHorizontalAlignment(hAlign);      if (hAlign != -1) b.setHorizontalAlignment(hAlign);
311      if (vAlign != -1) b.setVerticalAlignment(vAlign);      if (vAlign != -1) b.setVerticalAlignment(vAlign);
312      if (hPos != -1) b.setHorizontalTextPosition(hPos);      if (hPos != -1) b.setHorizontalTextPosition(hPos);
# Line 743  public class Demo Line 733  public class Demo
733      return c;      return c;
734    }    }
735    
736    public static JRadioButton mkRadio(String label)    public static JPanel mkRadio(String label)
737    {    {
738        JPanel p = new JPanel();
739      JRadioButton c = new JRadioButton(label);      JRadioButton c = new JRadioButton(label);
740      c.setFont(new Font("Luxi", Font.PLAIN, 14));      JRadioButton d = new JRadioButton("not " + label);
741      return c;      ButtonGroup bg = new ButtonGroup();
742        bg.add(c);
743        bg.add(d);
744        p.add(c);
745        p.add(d);
746        return p;
747    }    }
748    
749    public static JList mkList(Object[] elts)    public static JList mkList(Object[] elts)
# Line 1014  public class Demo Line 1010  public class Demo
1010      panel.setLayout(new FlowLayout());      panel.setLayout(new FlowLayout());
1011    
1012      new PopUpAction("Buttons",      new PopUpAction("Buttons",
1013                      mkPanel(new JComponent[]                      (new ButtonDemo("Button Demo")).createContent(),
                         {mkBigButton("mango"),  
                          mkBigButton("guava"),  
                          mkBigButton("lemon")}),  
1014                      panel);                      panel);
1015            
1016      new PopUpAction("Toggles",      new PopUpAction("Toggles",
# Line 1033  public class Demo Line 1026  public class Demo
1026                      panel);                      panel);
1027    
1028      new PopUpAction("Slider",      new PopUpAction("Slider",
1029                      mkSliders(),                      (new SliderDemo("Slider Demo")).createContent(),
1030                      panel);                      panel);
1031    
1032      new PopUpAction("List",      new PopUpAction("List",
# Line 1048  public class Demo Line 1041  public class Demo
1041                      panel);                      panel);
1042    
1043      new PopUpAction("Scrollbar",      new PopUpAction("Scrollbar",
1044                      mkScrollBar(),                      (new ScrollBarDemo("ScrollBar Demo")).createContent(),
1045                      panel);                      panel);
1046    
1047      new PopUpAction("Viewport",      new PopUpAction("Viewport",
# Line 1078  public class Demo Line 1071  public class Demo
1071                      panel);                      panel);
1072    
1073      new PopUpAction("ComboBox",      new PopUpAction("ComboBox",
1074                      mkComboBox(new String[] {"Stop",                      (new ComboBoxDemo("ComboBox Demo")).createContent(),
                                              "Software",  
                                              "Hoarders",  
                                              "Support",  
                                              "GNU!"}),  
1075                      panel);                      panel);
1076    
1077      new PopUpAction("Editor",      new PopUpAction("Editor",

Legend:
Removed from v.1.1.2.9  
changed lines
  Added in v.1.1.2.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26