1 package thinlet.drafts; 2 3 import java.awt.*; 4 import thinlet.*; 5 6 9 public class BeanTest { 10 11 14 public void setBorder(Thinlet thinlet, Object panel, boolean value) { 15 thinlet.setBoolean(panel, "border", value); 16 } 17 18 21 public void setScrollable(Thinlet thinlet, Object panel, boolean value) { 22 thinlet.setBoolean(panel, "scrollable", value); 23 } 24 25 28 public void setIcon(Thinlet thinlet, Object panel, boolean value) { 29 thinlet.setIcon(panel, "icon", value ? thinlet.getIcon("/icon/library.gif") : null); 30 } 31 32 35 public void setBackground(Thinlet thinlet, Object panel, boolean value) { 36 thinlet.setColor(panel, "background", value ? Color.orange : null); 37 } 38 39 42 public void setTitle(Thinlet thinlet, Object panel, String text) { 43 thinlet.setString(panel, "text", (text.length() > 0) ? text : null); 44 } 45 46 49 public void openDialog(Thinlet thinlet) throws Exception { 50 Object 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 61 public void openFileDialog(Thinlet thinlet) throws Exception { 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 72 public void exit() { 73 System.exit(0); 74 } 75 } | Popular Tags |