■
XSWTは違うっぽいのでCookSwtで遊んでみる。
CookSwtについてくるHello World!
リスナーの設定や、XMLのwidgetとJavaの変数のバインドもできるようだ。Linuxでちゃんとうごけばかなりいけそう。
DTDがない。DTDのないXMLはXMLBuddyとかでコードアシストがきかないからXMLの利点を活かせない。
HelloWorld.java
package examples.cookswt; import org.eclipse.swt.widgets.Display; import cookxml.cookswt.CookSwt; import cookxml.cookswt.util.SwtUtils; public class HelloWorld { public static void main (String[] args) { CookSwt cookSwt = new CookSwt (); SwtUtils.showDisplay((Display) cookSwt.xmlDecode ( "examples/cookswt/xml/helloworld.xml")); } }
helloworld.xml
<display> <shell style="SHELL_TRIM" text="Hello World!" size="640,480"> <filllayout> <clabel style="BORDER | CENTER" text="Hello World!" foreground="#ff0000" font="Serif,bold italic,20" cursor="HAND"/> </filllayout> </shell> </display>