overview-summary.html.svn-base

来自「j2me设计的界面包」· SVN-BASE 代码 · 共 415 行 · 第 1/2 页

SVN-BASE
415
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_01) on Thu Jun 05 13:35:11 IDT 2008 -->
<TITLE>
Overview
</TITLE>

<META NAME="date" CONTENT="2008-06-05">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="Overview";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Overview</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Use</FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="index.html?overview-summary.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="overview-summary.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
Overview
<P>
<B>See:</B>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="#overview_description"><B>Description</B></A>
<P>

<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Packages</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="20%"><B><A HREF="com/sun/lwuit/package-summary.html">com.sun.lwuit</A></B></TD>
<TD>
            Main widget package containing the component/container "composite" similar
            both in terminology and design to Swing/AWT.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="20%"><B><A HREF="com/sun/lwuit/animations/package-summary.html">com.sun.lwuit.animations</A></B></TD>
<TD>All components are animatable by potential and additional animations (unrelated        to a specifc component) can be installed on the fly, transitions between        forms are also handled as part of this package.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="20%"><B><A HREF="com/sun/lwuit/events/package-summary.html">com.sun.lwuit.events</A></B></TD>
<TD>            Observable pattern event listeners in the spirit of AWT 1.1's event            dispatching architecture, all events are dispatched on the EDT (Event Dispatch Thread).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="20%"><B><A HREF="com/sun/lwuit/geom/package-summary.html">com.sun.lwuit.geom</A></B></TD>
<TD>            Contains classes related to geometry locations and calculations such as             rectangle and size</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="20%"><B><A HREF="com/sun/lwuit/layouts/package-summary.html">com.sun.lwuit.layouts</A></B></TD>
<TD>            Layout managers allow a <A HREF="com/sun/lwuit/Container.html" title="class in com.sun.lwuit"><CODE>Container</CODE></A> to             arrange its components by a set of rules that would be adapted for specific            screen/font sizes.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="20%"><B><A HREF="com/sun/lwuit/list/package-summary.html">com.sun.lwuit.list</A></B></TD>
<TD>            Lists are highly customizable and serve as the basis for <A HREF="com/sun/lwuit/ComboBox.html" title="class in com.sun.lwuit"><CODE>ComboBox</CODE></A> and            other components (such as carousels etc) they employ a similar MVC approach to            Swing including the renderer pattern.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="20%"><B><A HREF="com/sun/lwuit/painter/package-summary.html">com.sun.lwuit.painter</A></B></TD>
<TD>            <A HREF="com/sun/lwuit/Painter.html" title="interface in com.sun.lwuit"><CODE>Painter</CODE></A> allows us to draw arbitrary elements            of graphics from plain/scaled/tiled images to gradients and pretty            much any form of graphic drawing we can imagin.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="20%"><B><A HREF="com/sun/lwuit/plaf/package-summary.html">com.sun.lwuit.plaf</A></B></TD>
<TD>            Look of the application can be fully customized via this package, it represents            a rendering layer that can be plugged in separately in runtime and themed to             provide any custom look.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="20%"><B><A HREF="com/sun/lwuit/util/package-summary.html">com.sun.lwuit.util</A></B></TD>
<TD>            Utility features that are either too domain specific or don't "fit" into any            other packages.</TD>
</TR>
</TABLE>

<P>
&nbsp;<A NAME="overview_description"><!-- --></A>
<P>
<H2>Overview</H2>
<P>The LightWeight User Interface Toolkit library (LWUIT) is inspired
by Swing but designed for constrained devices such as mobile phones
and set top boxes. LWUIT supports pluggable theme-ability, <A HREF="com/sun/lwuit/Component.html" title="class in com.sun.lwuit"><CODE>Component</CODE></A>/<A HREF="com/sun/lwuit/Container.html" title="class in com.sun.lwuit"><CODE>Container</CODE></A> hierarchy
and abstraction of underlying GUI toolkit. 
</P>
<P>Interfaces and API's of the underlying profile are abstracted by
internal toolkit interfaces and abstract classes. This allows
portability and a migration path for both current and future devices
and profiles. E.g. the graphics object of the underlying profile
would be encapsulated by <A HREF="com/sun/lwuit/Graphics.html" title="class in com.sun.lwuit"><CODE>Graphics</CODE></A>. 
</P>
<P>The toolkit tries to avoid the &quot;lowest common denominator&quot;
mentality by implementing some missing features in the lower end
platforms and taking better advantage of higher end platforms. 
</P>
<P>Partial class diagram:<BR><IMG SRC="classes.png" NAME="graphics1" ALIGN=BOTTOM WIDTH=1240 HEIGHT=498 BORDER=0>
</P>
<H3>Hello World Example</H3>
<P>Following is a simple hello world example written on top of MIDP,
all the LWUITcode is 100% binary compatible to other platforms such
as CDC. However, this example is specific for MIDP for AMS
requirements a MIDlet class must exist for MIDP where in a CDC
environment an Xlet would be expected (in Java SE we would expect a
main class etc...). 
</P>
<PRE><B>public</B> <B>class</B> <FONT COLOR="#2040a0">HiMidlet</FONT> <B>extends</B> <FONT COLOR="#2040a0">MIDlet</FONT> <B><FONT COLOR="#4444ff">{</FONT></B>

    <B>public</B> <B>void</B> <FONT COLOR="#2040a0">startApp</FONT><B><FONT COLOR="#4444ff">()</FONT></B> <B><FONT COLOR="#4444ff">{</FONT></B>
        <FONT COLOR="#2040a0">Display</FONT>.<FONT COLOR="#2040a0">init</FONT><B><FONT COLOR="#4444ff">(</FONT>this<FONT COLOR="#4444ff">)</FONT></B><FONT COLOR="#4444ff">;</FONT>

        <FONT COLOR="#2040a0">Form</FONT> <FONT COLOR="#2040a0">f</FONT> <FONT COLOR="#4444ff">=</FONT> <FONT COLOR="#2040a0">new Form</FONT><FONT COLOR="#4444ff"><B>()</B>;</FONT>
        <FONT COLOR="#2040a0">f</FONT>.<FONT COLOR="#2040a0">setTitle</FONT><B><FONT COLOR="#4444ff">(</FONT></B><FONT COLOR="#008000">&quot;Hello World&quot;</FONT><FONT COLOR="#4444ff"><B>)</B>;</FONT>

        <FONT COLOR="#2040a0">f</FONT>.<FONT COLOR="#2040a0">setLayout</FONT><B><FONT COLOR="#4444ff">(</FONT>new</B> <FONT COLOR="#2040a0">BorderLayout</FONT><FONT COLOR="#4444ff"><B>())</B>;</FONT>
        <FONT COLOR="#2040a0">f</FONT>.<FONT COLOR="#2040a0">add</FONT><B><FONT COLOR="#4444ff">(</FONT></B><FONT COLOR="#008000">&quot;Center&quot;</FONT>, <B>new</B> <FONT COLOR="#2040a0">Label</FONT><B><FONT COLOR="#4444ff">(</FONT></B><FONT COLOR="#008000">&quot;Hello Label&quot;</FONT><FONT COLOR="#4444ff"><B>))</B>;</FONT>

        <FONT COLOR="#2040a0">f</FONT>.<FONT COLOR="#2040a0">show</FONT><FONT COLOR="#4444ff"><B>()</B>;</FONT>        
    <B><FONT COLOR="#4444ff">}</FONT></B>

    <B>public</B> <B>void</B> <FONT COLOR="#2040a0">pauseApp</FONT><B><FONT COLOR="#4444ff">()</FONT></B> <B><FONT COLOR="#4444ff">{</FONT></B>
    <B><FONT COLOR="#4444ff">}</FONT></B>

    <B>public</B> <B>void</B> <FONT COLOR="#2040a0">destroyApp</FONT><B><FONT COLOR="#4444ff">(</FONT>boolean</B> <FONT COLOR="#2040a0">unconditional</FONT><B><FONT COLOR="#4444ff">)</FONT></B> <B><FONT COLOR="#4444ff">{</FONT></B>
    <B><FONT COLOR="#4444ff">}</FONT></B>
<FONT COLOR="#4444ff"><B>}</B></FONT>
        </PRE><P>
Notice in the example above that the very first line of code for any
application using this toolkit must register the main class with the
display. This behavior is toolkit specific since in MIDP there is not
much you can do without a reference to the parent MIDlet this
operation must be performed in the beginning of the application. 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?