KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > thinlet > drafts > BeanTest


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

9 public class BeanTest {
10     
11     /**
12      *
13      */

14     public void setBorder(Thinlet thinlet, Object JavaDoc panel, boolean value) {
15         thinlet.setBoolean(panel, "border", value);
16     }
17     
18     /**
19      *
20      */

21     public void setScrollable(Thinlet thinlet, Object JavaDoc panel, boolean value) {
22         thinlet.setBoolean(panel, "scrollable", value);
23     }
24     
25     /**
26      *
27      */

28     public void setIcon(Thinlet thinlet, Object JavaDoc panel, boolean value) {
29         thinlet.setIcon(panel, "icon", value ? thinlet.getIcon("/icon/library.gif") : null);
30     }
31     
32     /**
33      *
34      */

35     public void setBackground(Thinlet thinlet, Object JavaDoc panel, boolean value) {
36         thinlet.setColor(panel, "background", value ? Color.orange : null);
37     }
38     
39     /**
40      *
41      */

42     public void setTitle(Thinlet thinlet, Object JavaDoc panel, String JavaDoc text) {
43         thinlet.setString(panel, "text", (text.length() > 0) ? text : null);
44     }
45     
46     /**
47      *
48      */

49     public void openDialog(Thinlet thinlet) throws Exception JavaDoc {
50         Object JavaDoc dialog = Thinlet.create("dialog");
51         thinlet.setString(dialog, "text", "Dialog");
52         thinlet.setBoolean(dialog, "scrollable", true);
53         thinlet.setInteger(dialog, "width", 180); thinlet.setInteger(dialog, "height", 180);
54         thinlet.add(dialog, thinlet.parse("beantest.xml", this));
55         thinlet.add(dialog);
56     }
57     
58     /**
59      *
60      */

61     public void openFileDialog(Thinlet thinlet) throws Exception JavaDoc {
62         Container frame = thinlet;
63         while (!(frame instanceof Frame)) { frame = frame.getParent(); }
64         FileDialog filedialog = new FileDialog((Frame) frame,
65             "FileDialog...", FileDialog.LOAD);
66         filedialog.show();
67     }
68     
69     /**
70      *
71      */

72     public void exit() {
73         System.exit(0);
74     }
75 }
Popular Tags