/[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.11 by gnu_andrew, Wed Nov 2 21:44:46 2005 UTC revision 1.1.2.12 by gnu_andrew, Sun Nov 27 21:00:36 2005 UTC
# Line 29  import javax.swing.*; Line 29  import javax.swing.*;
29  import javax.swing.tree.*;  import javax.swing.tree.*;
30  import javax.swing.border.*;  import javax.swing.border.*;
31    
32    import javax.swing.plaf.metal.DefaultMetalTheme;
33  import javax.swing.plaf.metal.MetalLookAndFeel;  import javax.swing.plaf.metal.MetalLookAndFeel;
34  import javax.swing.plaf.metal.OceanTheme;  import javax.swing.plaf.metal.OceanTheme;
35    
# Line 72  public class Demo Line 73  public class Demo
73                                                     JOptionPane.OK_OPTION,                                                     JOptionPane.OK_OPTION,
74                                                     JOptionPane.QUESTION_MESSAGE,                                                     JOptionPane.QUESTION_MESSAGE,
75                                                     null, lafs, DEFAULT);                                                     null, lafs, DEFAULT);
76            if (laf == 0)
77              {
78                MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
79                UIManager.setLookAndFeel(new MetalLookAndFeel());
80              }
81              if (laf == 1)              if (laf == 1)
82                {                {
83                  MetalLookAndFeel.setCurrentTheme(new OceanTheme());                  MetalLookAndFeel.setCurrentTheme(new OceanTheme());
84                UIManager.setLookAndFeel(new MetalLookAndFeel());                  UIManager.setLookAndFeel(new MetalLookAndFeel());
85                }                }
86              else if (laf == 2)              else if (laf == 2)
87                UIManager.setLookAndFeel(new GNULookAndFeel());                UIManager.setLookAndFeel(new GNULookAndFeel());
# Line 171  public class Demo Line 177  public class Demo
177                      examples);                      examples);
178    
179      new PopUpAction("Slider",      new PopUpAction("Slider",
180                      mkSliders(),                      (new SliderDemo("Slider Demo")).createContent(),
181                      examples);                      examples);
182    
183        new PopUpAction("ProgressBar",
184                        ProgressBarDemo.createContent(),
185                        examples);
186    
187      new PopUpAction("List",      new PopUpAction("List",
188                      mkListPanel(new String[] { "hello",                      mkListPanel(new String[] { "hello",
189                                                 "this",                                                 "this",
# Line 208  public class Demo Line 218  public class Demo
218                      examples);                      examples);
219    
220      new PopUpAction("TextField",      new PopUpAction("TextField",
221                      mkTextField("Hello, World!"),                      (new TextFieldDemo("TextField Demo")).createContent(),
222                      examples);                      examples);
223    
224        new PopUpAction("FileChooser",
225                        (new FileChooserDemo("FileChooser Demo")).createContent(),
226                        examples);
227    
228      new PopUpAction("ColorChooser",      new PopUpAction("ColorChooser",
229                      mkColorChooser(),                      mkColorChooser(),
230                      examples);                      examples);
# Line 688  public class Demo Line 702  public class Demo
702      return tabs;      return tabs;
703    }    }
704    
   static JComponent mkSliders()  
   {  
     JSlider slider = new JSlider();  
     slider.setPaintTrack(true);  
     slider.setPaintTicks(true);  
     slider.setMajorTickSpacing(30);  
     slider.setMinorTickSpacing(5);  
     slider.setPaintLabels(true);  
     slider.setInverted(false);  
     JProgressBar progress = new JProgressBar();  
     BoundedRangeModel model = new DefaultBoundedRangeModel(10, 1, 0, 100);  
     progress.setModel(model);  
     slider.setModel(model);  
     JPanel panel = new JPanel();  
     panel.setLayout(new GridLayout(1, 2));  
     panel.add(slider);  
     panel.add(progress);  
     return panel;  
   }  
   
705    public Demo()    public Demo()
706    {    {
707      frame = new JFrame("Swing Activity Board");      frame = new JFrame("Swing Activity Board");
# Line 1018  public class Demo Line 1012  public class Demo
1012        
1013    private JPanel mkButtonBar()    private JPanel mkButtonBar()
1014    {        {    
1015      JPanel panel = new JPanel ();      JPanel panel = new JPanel (new GridLayout(2, 1));
1016      panel.setLayout(new FlowLayout());      JPanel panelA = new JPanel(new FlowLayout());
1017        JPanel panelB = new JPanel(new FlowLayout());
1018    
1019      new PopUpAction("Buttons",      new PopUpAction("Buttons",
1020                      (new ButtonDemo("Button Demo")).createContent(),                      (new ButtonDemo("Button Demo")).createContent(),
1021                      panel);                      panelA);
1022            
1023      new PopUpAction("Toggles",      new PopUpAction("Toggles",
1024                      mkToggle("cool and refreshing"),                      mkToggle("cool and refreshing"),
1025                      panel);                      panelA);
1026    
1027      new PopUpAction("Checkbox",      new PopUpAction("Checkbox",
1028                      mkCheckbox("ice cold"),                      mkCheckbox("ice cold"),
1029                      panel);                      panelA);
1030    
1031      new PopUpAction("Radio",      new PopUpAction("Radio",
1032                      mkRadio("delicious"),                      mkRadio("delicious"),
1033                      panel);                      panelA);
1034    
1035      new PopUpAction("Slider",      new PopUpAction("Slider",
1036                      (new SliderDemo("Slider Demo")).createContent(),                      (new SliderDemo("Slider Demo")).createContent(),
1037                      panel);                      panelA);
1038    
1039        new PopUpAction("ProgressBar",
1040                ProgressBarDemo.createContent(),
1041                 panelA);
1042    
1043    
1044      new PopUpAction("List",      new PopUpAction("List",
1045                      mkListPanel(new String[] { "hello",                      mkListPanel(new String[] { "hello",
# Line 1050  public class Demo Line 1050  public class Demo
1050                                                 "that",                                                 "that",
1051                                                 "wraps",                                                 "wraps",
1052                                                 "over"}),                                                 "over"}),
1053                      panel);                      panelA);
1054    
1055      new PopUpAction("Scrollbar",      new PopUpAction("Scrollbar",
1056                      (new ScrollBarDemo("ScrollBar Demo")).createContent(),                      (new ScrollBarDemo("ScrollBar Demo")).createContent(),
1057                      panel);                      panelA);
1058    
1059      new PopUpAction("Viewport",      new PopUpAction("Viewport",
1060                      mkViewportBox(mkBigButton("View Me!")),                      mkViewportBox(mkBigButton("View Me!")),
1061                      panel);                      panelA);
1062    
1063      new PopUpAction("ScrollPane",      new PopUpAction("ScrollPane",
1064                      mkScrollPane(mkBigButton("Scroll Me!")),                      mkScrollPane(mkBigButton("Scroll Me!")),
1065                      panel);                      panelA);
1066    
1067      new PopUpAction("TabPane",      new PopUpAction("TabPane",
1068                      mkTabs(new String[] {"happy",                      mkTabs(new String[] {"happy",
1069                                           "sad",                                           "sad",
1070                                           "indifferent"}),                                           "indifferent"}),
1071                      panel);                      panelB);
1072    
1073      new PopUpAction("Spinner",      new PopUpAction("Spinner",
1074                      mkSpinner(),                      mkSpinner(),
1075                      panel);                      panelB);
1076    
1077      new PopUpAction("TextField",      new PopUpAction("TextField",
1078                      mkTextField("Hello, World!"),                      (new TextFieldDemo("TextField Demo")).createContent(),
1079                      panel);                      panelB);
1080    
1081        new PopUpAction("FileChooser",
1082                        (new FileChooserDemo("FileChooser Demo")).createContent(),
1083                        panelB);
1084    
1085      new PopUpAction("ColorChooser",      new PopUpAction("ColorChooser",
1086                      mkColorChooser(),                      mkColorChooser(),
1087                      panel);                      panelB);
1088    
1089      new PopUpAction("ComboBox",      new PopUpAction("ComboBox",
1090                      (new ComboBoxDemo("ComboBox Demo")).createContent(),                      (new ComboBoxDemo("ComboBox Demo")).createContent(),
1091                      panel);                      panelB);
1092    
1093      new PopUpAction("Editor",      new PopUpAction("Editor",
1094                      mkEditorPane(),                      mkEditorPane(),
1095                      panel);                      panelB);
1096            
1097      new PopUpAction("Tree",      new PopUpAction("Tree",
1098                      mkTree(),                      mkTree(),
1099                      panel);                      panelB);
1100            
1101      new PopUpAction("Table",      new PopUpAction("Table",
1102                      mkTable(),                      mkTable(),
1103                      panel);                      panelB);
1104            
1105      JButton exitDisposer = mkDisposerButton(frame);      JButton exitDisposer = mkDisposerButton(frame);
1106      panel.add(exitDisposer);      panelB.add(exitDisposer);
1107      exitDisposer.addActionListener(new ActionListener()      exitDisposer.addActionListener(new ActionListener()
1108        {        {
1109          public void actionPerformed(ActionEvent e)          public void actionPerformed(ActionEvent e)
# Line 1107  public class Demo Line 1111  public class Demo
1111            System.exit(1);            System.exit(1);
1112          }          }
1113        });        });
1114        panel.add(panelA);
1115        panel.add(panelB);
1116      return panel;      return panel;
1117    }    }
   
   public static JTextField mkTextField(String sometext)  
   {  
     return new JTextField(sometext, 40);  
   }  
1118  }  }

Legend:
Removed from v.1.1.2.11  
changed lines
  Added in v.1.1.2.12

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