[Thinlet-development] thinlet/src/midp/thinlet/midp/examples/demo Demo.java,NONE,1.1 demo.xml,NONE,1
Brought to you by:
bajzat
From: <ab...@us...> - 2003-06-26 15:22:01
|
Update of /cvsroot/thinlet/thinlet/src/midp/thinlet/midp/examples/demo In directory sc8-pr-cvs1:/tmp/cvs-serv29772/src/midp/thinlet/midp/examples/demo Added Files: Demo.java demo.xml image.png Log Message: New CVS layout and build infrastructure. Contributed by Campbell Boucher-Burnet. Many thanks\! --- NEW FILE: Demo.java --- package thinlet.midp.examples.demo; import javax.microedition.lcdui.*; import javax.microedition.midlet.*; import thinlet.midp.*; public class Demo extends MIDlet { Display display; protected void startApp() throws MIDletStateChangeException { display = Display.getDisplay(this); DemoCanvas canvas = new DemoCanvas(this); display.setCurrent(canvas); } protected void pauseApp() { } void destroyImpl() { try { destroyApp(false); notifyDestroyed(); } catch (MIDletStateChangeException mste) {} } protected void destroyApp(boolean unconditional) throws MIDletStateChangeException { display.setCurrent(null); } } class DemoCanvas extends Thinlet { private static final Command exitcommand = new Command("Exit", Command.EXIT, 0); private Demo midlet; public DemoCanvas(Demo midlet) { this.midlet = midlet; try { add(parse("demo.xml")); } catch (Exception exc) { exc.printStackTrace(); } addCommand(exitcommand); } public void commandAction(Command command, Displayable displayable) { if (command == exitcommand) { midlet.destroyImpl(); } else super.commandAction(command, displayable); } protected void handle(Object source, Object part, String action) { if ("selectlist".equals(action)) { int index = getInteger(find("selectmode"), "selected"); setBoolean(find("demolist"), "visible", index == 0); setBoolean(find("demotree"), "visible", index == 1); setBoolean(find("demotable"), "visible", index == 2); } } } --- NEW FILE: demo.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <tabbedpane selected="2"> <tab text="Basic" /> <panel columns="1" top="4" left="4" bottom="4" right="4" gap="4"> <label text="Label" icon="/thinlet/midp/demo/image.png" /> <button text="Button" icon="/thinlet/midp/demo/image.png" /> <checkbox text="CheckBox" selected="true" /> <progressbar value="50" /> <slider value="50" /> </panel> <tab text="Text" /> <panel columns="1" top="4" left="4" bottom="4" right="4" gap="4"> <textfield text="TextField" /> <passwordfield text="Password" /> <textarea text="TextArea" weightx="1" weighty="1" /> <spinbox text="100" /> </panel> <tab text="List" /> <panel columns="1" top="4" left="4" bottom="4" right="4" gap="4"> <combobox name="selectmode" editable="false" selected="1" weightx="1" action="selectlist" > <choice text="List" /> <choice text="Tree" /> <choice text="Table" /> </combobox> <list name="demolist" weighty="1" visible="false"> <item text="List item" /> <item selected="true" text="List item" /> <item text="List item" /> </list> <tree name="demotree" weighty="1"> <node text="Tree node"> <node text="Tree node" /> </node> <node text="Tree node"> <node selected="true" text="Tree node"> <node text="Tree node" /> <node selected="true" text="Tree node" /> </node> </node> <node text="Tree node" /> <node text="Tree node" /> </tree> <table name="demotable" weighty="1" visible="false"> <column text="Column" /><column text="Column" /> <row><cell text="Cell" /><cell text="Cell" /></row> <row selected="true"><cell text="Cell" /><cell text="Cell" /></row> <row><cell text="Cell" /><cell text="Cell" /></row> </table> </panel> </tabbedpane> --- NEW FILE: image.png --- (This appears to be a binary file; contents omitted.) |