Motorola的J2ME界面扩展——LWT介绍

MotorolaJ2ME界面扩展——LWT介绍

作者:陈跃峰

出自:http://blog.csdn.net/mailbomb

LWT(Lightweight Window Toolkit)Motorola公司对MIDPjavax.microedition.lcdui界面包的一个扩展,可以在Motorola系列的手机中象使用MIDP界面一样来进行使用,解决了MIDP界面不能通过屏幕层次进行控制,以及无法实现个性化控件的问题(注:MIDP2.0通过使用game API控制屏幕层次,通过CustomItem来实现个性化的控件)

LWT实现的目标:

l LWT包实现小于30KB

l 运行高效

l 易扩展

l MIDP兼容

l 单层次

LWT包中包含的类的继承结构图如下:

<group id="_x0000_s1026" style="WIDTH: 441pt; HEIGHT: 358.8pt; mso-position-horizontal-relative: char; mso-position-vertical-relative: line" coordsize="8820,7176" coordorigin="1440,6275" editas="canvas"><lock aspectratio="t" v:ext="edit"></lock><shapetype id="_x0000_t75" coordsize="21600,21600" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></path><lock aspectratio="t" v:ext="edit"></lock></shapetype><shape id="_x0000_s1027" style="LEFT: 1440px; WIDTH: 8820px; POSITION: absolute; TOP: 6275px; HEIGHT: 7176px" o:preferrelative="f" type="#_x0000_t75"><font size="3"><fill o:detectmouseclick="t"></fill><path o:connecttype="none" o:extrusionok="t"></path><lock v:ext="edit" text="t"></lock></font></shape><group id="_x0000_s1028" style="LEFT: 1620px; WIDTH: 8460px; POSITION: absolute; TOP: 6275px; HEIGHT: 6864px" coordsize="8460,6864" coordorigin="1620,6275"><rect id="_x0000_s1029" style="LEFT: 2160px; WIDTH: 1080px; POSITION: absolute; TOP: 7055px; HEIGHT: 468px" filled="f"><textbox style="mso-next-textbox: #_x0000_s1029"><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman" size="3">Object</font></span></p></div></td></tr></tbody></table></textbox></rect><roundrect id="_x0000_s1030" style="LEFT: 1620px; WIDTH: 2160px; POSITION: absolute; TOP: 6587px; HEIGHT: 1093px" filled="f" arcsize="10923f"><textbox style="mso-next-textbox: #_x0000_s1030"><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">java.lang<p></p></font></span></p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><p><font face="Times New Roman" size="3"></font></p></span></p> </div></td></tr></tbody></table></textbox></roundrect><rect id="_x0000_s1031" style="LEFT: 2160px; WIDTH: 1080px; POSITION: absolute; TOP: 8927px; HEIGHT: 468px"><textbox style="mso-next-textbox: #_x0000_s1031"><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman" size="3">Graphics</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1032" style="LEFT: 2160px; WIDTH: 1080px; POSITION: absolute; TOP: 9707px; HEIGHT: 468px"><textbox style="mso-next-textbox: #_x0000_s1032"><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font face="Times New Roman" size="3">Font</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1033" style="LEFT: 2160px; WIDTH: 1080px; POSITION: absolute; TOP: 10487px; HEIGHT: 468px"><textbox style="mso-next-textbox: #_x0000_s1033"><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font face="Times New Roman" size="3">Image</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1034" style="LEFT: 2160px; WIDTH: 1080px; POSITION: absolute; TOP: 12203px; HEIGHT: 468px"><textbox style="mso-next-textbox: #_x0000_s1034"><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman" size="3">Canvas</font></span></p></div></td></tr></tbody></table></textbox></rect><roundrect id="_x0000_s1035" style="LEFT: 1620px; WIDTH: 2340px; POSITION: absolute; TOP: 8303px; HEIGHT: 4836px" filled="f" arcsize="10923f"><textbox style="mso-next-textbox: #_x0000_s1035"><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="FONT-SIZE: 9pt"><font face="Times New Roman">javax.microedition.lcdui<p></p></font></span></p></div></td></tr></tbody></table></textbox></roundrect><rect id="_x0000_s1036" style="LEFT: 4680px; WIDTH: 1800px; POSITION: absolute; TOP: 7055px; HEIGHT: 468px"><textbox style="mso-next-textbox: #_x0000_s1036"><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman" size="3">CheckboxGroup</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1037" style="LEFT: 4680px; WIDTH: 1800px; POSITION: absolute; TOP: 7991px; HEIGHT: 468px"><textbox style="mso-next-textbox: #_x0000_s1037"><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font face="Times New Roman" size="3">Component</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1038" style="LEFT: 7920px; WIDTH: 1980px; POSITION: absolute; TOP: 7055px; HEIGHT: 468px"><textbox style="mso-next-textbox: #_x0000_s1038"><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman" size="3">ComponentListener</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1039" style="LEFT: 5400px; WIDTH: 2340px; POSITION: absolute; TOP: 9551px; HEIGHT: 468px"><textbox><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font face="Times New Roman" size="3">TextComponent</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1040" style="LEFT: 5400px; WIDTH: 2340px; POSITION: absolute; TOP: 10955px; HEIGHT: 468px"><textbox><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman" size="3">InteractableComponent</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1041" style="LEFT: 4680px; WIDTH: 1980px; POSITION: absolute; TOP: 12203px; HEIGHT: 468px"><textbox><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman" size="3">ComponentScreen</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1042" style="LEFT: 8280px; WIDTH: 1440px; POSITION: absolute; TOP: 8615px; HEIGHT: 468px"><textbox><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font face="Times New Roman" size="3">Slider</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1043" style="LEFT: 8280px; WIDTH: 1440px; POSITION: absolute; TOP: 9551px; HEIGHT: 468px"><textbox><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font face="Times New Roman" size="3">TextField</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1044" style="LEFT: 8280px; WIDTH: 1440px; POSITION: absolute; TOP: 10175px; HEIGHT: 468px"><textbox><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font face="Times New Roman" size="3">TextArea</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1045" style="LEFT: 8280px; WIDTH: 1440px; POSITION: absolute; TOP: 10955px; HEIGHT: 468px"><textbox><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font face="Times New Roman" size="3">Checkbox</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1046" style="LEFT: 8280px; WIDTH: 1440px; POSITION: absolute; TOP: 11735px; HEIGHT: 468px"><textbox><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font face="Times New Roman" size="3">ImageLabel</font></span></p></div></td></tr></tbody></table></textbox></rect><rect id="_x0000_s1047" style="LEFT: 8280px; WIDTH: 1440px; POSITION: absolute; TOP: 12515px; HEIGHT: 468px"><textbox><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font face="Times New Roman" size="3">Button</font></span></p></div></td></tr></tbody></table></textbox></rect><line id="_x0000_s1048" style="POSITION: absolute" to="4680,12360" from="3240,12359"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1049" style="POSITION: absolute" to="4680,7211" from="3240,7211"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1050" style="POSITION: absolute" to="4680,8148" from="4140,8147"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1051" style="POSITION: absolute; flip: y" to="4140,8147" from="4140,7211"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1052" style="POSITION: absolute" to="4860,11267" from="4860,8459"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1053" style="POSITION: absolute" to="8280,8772" from="4860,8771"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1054" style="POSITION: absolute" to="5400,9707" from="4860,9707"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1055" style="POSITION: absolute" to="5400,11267" from="4860,11267"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1056" style="POSITION: absolute" to="8280,9707" from="7740,9707"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1057" style="POSITION: absolute" to="8280,10332" from="8100,10331"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1058" style="POSITION: absolute; flip: y" to="8100,10331" from="8100,9707"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1059" style="POSITION: absolute" to="8280,11111" from="7740,11111"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1060" style="POSITION: absolute" to="7920,12827" from="7920,11111"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1061" style="POSITION: absolute" to="8280,12047" from="7920,12047"><font face="Times New Roman" size="3"></font></line><line id="_x0000_s1062" style="POSITION: absolute" to="8280,12827" from="7920,12827"><font face="Times New Roman" size="3"></font></line><roundrect id="_x0000_s1063" style="LEFT: 4320px; WIDTH: 5760px; POSITION: absolute; TOP: 6275px; HEIGHT: 6864px" filled="f" arcsize="10923f"><textbox><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td style="BORDER-RIGHT: #cdcbd1; BORDER-TOP: #cdcbd1; BORDER-LEFT: #cdcbd1; BORDER-BOTTOM: #cdcbd1; BACKGROUND-COLOR: transparent"><div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman" size="3">com.motorola.lwt</font></span></p></div></td></tr></tbody></table></textbox></roundrect></group><wrap type="none"></wrap><anchorlock></anchorlock></group>

使用LWT编程和一般的Java类类似,下面是一个简单的示例代码:

public class TestScreen extends ComponentScreen {

public DemoScreen() {

Command next = new Command("Next", Command.OK, 1);

Command prev = new Command("Previous", Command.BACK, 1);

addCommand(next);

addCommand(prev);

}

}

你可能感兴趣的:(编程,F#,ext,Blog,Motorola)