KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > thinlet > drafts > Widgets


1 package thinlet.drafts;
2
3 import thinlet.*;
4 import java.io.*;
5
6 /**
7  *
8  */

9 public class Widgets {
10     
11     public void perform() { /*System.out.println("perform");*/ }
12     public void ok() { /*System.out.println("ok");*/ }
13     public void cancel() { /*System.out.println("cancel");*/ }
14     public void cut() { /*System.out.println("cut");*/ }
15     public void copy() { /*System.out.println("copy");*/ }
16     public void paste() { /*System.out.println("paste");*/ }
17     public void delete() { /*System.out.println("delete");*/ }
18     
19     public void loadText(Thinlet thinlet, Object JavaDoc textarea) throws Exception JavaDoc {
20         StringBuffer JavaDoc helpText = new StringBuffer JavaDoc();
21         BufferedReader reader = new BufferedReader(
22             new FileReader(new File("src/thinlet/drafts/Widgets.java")));
23         String JavaDoc line = null;
24         while ((line = reader.readLine()) != null) {
25             helpText.append(line + "\n");
26         }
27         thinlet.setString(textarea, "text", helpText.toString());
28     }
29     
30     public void setLine(Thinlet thinlet, Object JavaDoc component, boolean line) {
31         thinlet.setBoolean(component, "line", line);
32     }
33     
34     public void showDialog(Thinlet thinlet) throws Exception JavaDoc {
35         Object JavaDoc dialog = Thinlet.create("dialog");
36         thinlet.setString(dialog, "text", "Dialog");
37         thinlet.setBoolean(dialog, "scrollable", true);
38         thinlet.setInteger(dialog, "width", 180); thinlet.setInteger(dialog, "height", 180);
39         thinlet.add(dialog, thinlet.parse("/thinlet/drafts/widgets.xml", this));
40         thinlet.add(dialog);
41     }
42 }
Popular Tags