KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > wingset > TemplateExample


1 /*
2  * $Id: TemplateExample.java,v 1.4 2004/12/01 07:54:05 hengels Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package wingset;
15
16 import org.wings.*;
17
18 import javax.swing.tree.DefaultTreeModel JavaDoc;
19
20 /**
21  * @author <a HREF="mailto:hzeller@to.com">Henner Zeller</a>
22  * @version $Revision: 1.4 $
23  */

24 public class TemplateExample
25         extends WingSetPane
26         implements SConstants {
27
28     protected SComponent createExample() {
29         SForm c = new SForm();
30
31         try {
32             java.net.URL JavaDoc templateURL =
33                     getSession().getServletContext().getResource("/templates/TemplateExample.thtml");
34             if (templateURL == null) {
35                 c.add(new SLabel("Sorry, can't find TemplateExample.thtml. Are you using a JAR-File?"));
36                 return c;
37             }
38             // you can of course directly give files here.
39
STemplateLayout layout = new STemplateLayout(templateURL);
40             c.setLayout(layout);
41         } catch (java.io.IOException JavaDoc except) {
42             except.printStackTrace();
43         }
44         
45         //c.add(new STextArea(), "DemoArea");
46
c.add(new SLabel((new java.util.Date JavaDoc()).toString()), "theLabel");
47         c.add(new SButton("Press Me"), "TESTBUTTON");
48         c.add(new STextField(), "NAME");
49         c.add(new STextField(), "FIRSTNAME");
50         SButtonGroup group = new SButtonGroup();
51         for (int i = 0; i < 3; i++) {
52             SRadioButton b = new SRadioButton("Radio " + (i + 1));
53             group.add(b);
54             c.add(b, "SELVAL=" + i);
55         }
56
57         STree tree = new STree(new DefaultTreeModel JavaDoc(HugeTreeModel.ROOT_NODE));
58         c.add(tree, "TREE");
59         return c;
60     }
61 }
62
63
64
Popular Tags