1 14 package wingset; 15 16 import org.wings.*; 17 18 import javax.swing.tree.DefaultTreeModel ; 19 20 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 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 STemplateLayout layout = new STemplateLayout(templateURL); 40 c.setLayout(layout); 41 } catch (java.io.IOException except) { 42 except.printStackTrace(); 43 } 44 45 c.add(new SLabel((new java.util.Date ()).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 (HugeTreeModel.ROOT_NODE)); 58 c.add(tree, "TREE"); 59 return c; 60 } 61 } 62 63 64 | Popular Tags |