﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-来点Java的感觉-随笔分类-J2ME</title><link>http://www.blogjava.net/hsith/category/10328.html</link><description>磨碎Java,我请你喝一杯.........
&lt;!-- SiteSearch Google --&gt;
&lt;form method="get" action="http://www.google.cn/custom" target="google_window"&gt;
&lt;table border="0" bgcolor="#ffffff"&gt;
&lt;tr&gt;&lt;td nowrap="nowrap" valign="top" align="left" height="32"&gt;
&lt;a href="http://www.google.com/"&gt;
&lt;img src="http://www.seejava.com/view/images/logo.gif" border="0" alt="Google" align="middle"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/td&gt;
&lt;td nowrap="nowrap"&gt;
&lt;input type="hidden" name="domains" value="您的域名"&gt;&lt;/input&gt;
&lt;input type="text" name="q" size="30" maxlength="255" value=""&gt;&lt;/input&gt;
&lt;input type="submit" name="sa" value="搜索"&gt;&lt;/input&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td nowrap="nowrap"&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;input type="radio" name="sitesearch" value="" checked="checked"&gt;&lt;/input&gt;
&lt;font size="-1" color="#000000"&gt;Web&lt;/font&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;input type="radio" name="sitesearch" value="您的域名"&gt;&lt;/input&gt;
&lt;font size="-1" color="#000000"&gt;您的域名&lt;/font&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;input type="hidden" name="client" value="pub-4751025308591894"&gt;&lt;/input&gt;
&lt;input type="hidden" name="forid" value="1"&gt;&lt;/input&gt;
&lt;input type="hidden" name="ie" value="GB2312"&gt;&lt;/input&gt;
&lt;input type="hidden" name="oe" value="GB2312"&gt;&lt;/input&gt;
&lt;input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:50;L:http://www.ppczone.org/images/newsblobs/java.jpg;S:http://www.blogjava.net/hsith/;FORID:1;"&gt;&lt;/input&gt;
&lt;input type="hidden" name="hl" value="zh-CN"&gt;&lt;/input&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/form&gt;
&lt;!-- SiteSearch Google --&gt;</description><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 14:29:35 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 14:29:35 GMT</pubDate><ttl>60</ttl><item><title>用Sprite编写J2ME程序--第四章 碰撞检验</title><link>http://www.blogjava.net/hsith/archive/2006/05/03/44430.html</link><dc:creator>学二的猫</dc:creator><author>学二的猫</author><pubDate>Wed, 03 May 2006 04:16:00 GMT</pubDate><guid>http://www.blogjava.net/hsith/archive/2006/05/03/44430.html</guid><wfw:comment>http://www.blogjava.net/hsith/comments/44430.html</wfw:comment><comments>http://www.blogjava.net/hsith/archive/2006/05/03/44430.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/hsith/comments/commentRss/44430.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hsith/services/trackbacks/44430.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本文通过实例详细介绍了MDIP2.0中精灵间碰撞检验的处理方法和技巧，以及图层管理器和像素级碰撞的使用。&nbsp;&nbsp;<a href='http://www.blogjava.net/hsith/archive/2006/05/03/44430.html'>阅读全文</a><img src ="http://www.blogjava.net/hsith/aggbug/44430.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hsith/" target="_blank">学二的猫</a> 2006-05-03 12:16 <a href="http://www.blogjava.net/hsith/archive/2006/05/03/44430.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用Sprite编写J2ME程序--第三章 用精灵实现动画</title><link>http://www.blogjava.net/hsith/archive/2006/04/27/43466.html</link><dc:creator>学二的猫</dc:creator><author>学二的猫</author><pubDate>Thu, 27 Apr 2006 01:19:00 GMT</pubDate><guid>http://www.blogjava.net/hsith/archive/2006/04/27/43466.html</guid><wfw:comment>http://www.blogjava.net/hsith/comments/43466.html</wfw:comment><comments>http://www.blogjava.net/hsith/archive/2006/04/27/43466.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/hsith/comments/commentRss/43466.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hsith/services/trackbacks/43466.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本文通过一个例子介绍了如何用Sprite实现动画；并对源代码进行了分段详细剖析。&nbsp;&nbsp;<a href='http://www.blogjava.net/hsith/archive/2006/04/27/43466.html'>阅读全文</a><img src ="http://www.blogjava.net/hsith/aggbug/43466.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hsith/" target="_blank">学二的猫</a> 2006-04-27 09:19 <a href="http://www.blogjava.net/hsith/archive/2006/04/27/43466.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse3.1.1+EclipseME1.5+WTK2.2搭建J2ME开发环境</title><link>http://www.blogjava.net/hsith/archive/2006/04/24/42845.html</link><dc:creator>学二的猫</dc:creator><author>学二的猫</author><pubDate>Mon, 24 Apr 2006 08:33:00 GMT</pubDate><guid>http://www.blogjava.net/hsith/archive/2006/04/24/42845.html</guid><wfw:comment>http://www.blogjava.net/hsith/comments/42845.html</wfw:comment><comments>http://www.blogjava.net/hsith/archive/2006/04/24/42845.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hsith/comments/commentRss/42845.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hsith/services/trackbacks/42845.html</trackback:ping><description><![CDATA[
		<p align="left">
				<font color="#ffa500">Eclipse3.1.1+EclipseME1.5+WTK2.2搭建J2ME开发环境<br /><br /></font>
				<font color="#008000" size="2">由于我的EclipseME的版本已经很旧了，今天上午从网上下了最新的EclipseME1.5。动手重新搭建了一下J2ME开发环境，发现最新的Eclipse1.5比早期版本功能强大了许多，配置上也略有不同。不过配置的思想和流程大体相同，所以2分钟内搞定。心情甚爽，惬意之余我把EclipseME1.5的配置过程写了下来，供各位遇到问题的朋友参考^.^<br /><br />1、下载安装EclipseME1.5<br />      <br />      EclipseME1.5的下载地址：<a href="http://jaist.dl.sourceforge.net/sourceforge/eclipseme/eclipseme.feature_1.5.0_site.zip"><font size="3">http://jaist.dl.sourceforge.net/sourceforge/eclipseme/eclipseme.feature_1.5.0_site.zip</font></a><br />      EclipseME1.5目前只有英文版，我已经在图片上把界面中的英文做了相应翻译。将下载下来的EclipseME1.5压缩包解压，解压后会有两个文件夹features和plugins。将两个文件夹内的内容分别拷贝到Eclipse安装目录下的features和plugins目录下。这时启动Eclipse。<br /><br />2、配置EclipseME1.5<br /><br />     在此，我假设你已经安装了WTK。如果没有，请到Sun公司的网站上下载。Eclipse启动后点击窗口--&gt;首选项(如图1)。<br /><img height="290" alt="o_1.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10427/o_1.jpg" width="370" border="0" />（图1）<br />弹出（图2）显示的首选项对话框。如果EclipseME插件安装成功，则在对话框左侧的树中能够看到J2ME节点。中选择J2ME进行相关配置。<br /><br />Step 1、设置WTK根目录<br />              点击左侧树中的“J2ME”，出现如下图界面。这里唯一需要配置的是WTK     Root。在这一项中要填入WTK的安装根目录。例如，我的WTK安装在D:\WTK22。其余的使用默认即可。值得一提的是Antenna JAR这一项。Antenna JAR不是一个必设项，但是使用Antenna Jar能够编写Ant文件，轻松打包J2ME程序。（有时间我会介绍如何用Antenna JAR编写打包J2ME程序的Ant脚本。）<br /><img height="525" alt="o_2.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10427/o_2.jpg" width="711" border="0" /><br />（图2）<br /><br />Step 2、设备管理<br />              点击“Device Management”,出现（图3）配置界面。点击“Browse”，选择WTK安装目录下的bin文件夹。例如我的bin文件夹的路径为D:\WTK22\bin。然后再单击“Refresh”。插件会自动搜索出可用的设备。<br /><img height="408" alt="o_3.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10427/o_3.jpg" width="733" border="0" /><br />（图3）<br />完成上面工作后，可以说你的J2ME环境基本上就搭建好了。你可以在上面新建、编译、测试、打包你的程序了。怎么样简单吧？但是有一个问题，我们没有设置混淆器，不能使用“Create Obfuscated Package”。混淆器对减小Jar包大小，防止程序被反编译很有用，因此很有必要在J2ME开发环境中设置混淆器。<br /><img height="204" alt="4.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10427/4.jpg" width="430" border="0" />（图4）<br /><br />Step 3、设置混淆器Proguard <br /></font>
				<font color="#008000" size="2">             设置前请先下载Proguard。目前Proguard的最新版本是3.6Beta（4.0正在开发中）。我用的是3.5。你可以在此下载到：EclipseME单击“Obfuscation”，出现下图界面。在“Progurd Root Directory”填入Proguard的安装目录。<br /><img height="525" alt="o_5.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10427/o_5.jpg" width="623" border="0" />（图5）<br /><br />好了，这样你的J2ME开发环境就搭建好了，你可以开始用Eclipse进行J2ME开发了。当然我们的EclipseME之旅才刚刚开始，更多的设置和使用方法大家以后在使用中慢慢探索吧。</font>
		</p>
<img src ="http://www.blogjava.net/hsith/aggbug/42845.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hsith/" target="_blank">学二的猫</a> 2006-04-24 16:33 <a href="http://www.blogjava.net/hsith/archive/2006/04/24/42845.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用Sprite编写J2ME程序--第二章 Sprite简介</title><link>http://www.blogjava.net/hsith/archive/2006/04/22/42467.html</link><dc:creator>学二的猫</dc:creator><author>学二的猫</author><pubDate>Sat, 22 Apr 2006 03:52:00 GMT</pubDate><guid>http://www.blogjava.net/hsith/archive/2006/04/22/42467.html</guid><wfw:comment>http://www.blogjava.net/hsith/comments/42467.html</wfw:comment><comments>http://www.blogjava.net/hsith/archive/2006/04/22/42467.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hsith/comments/commentRss/42467.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hsith/services/trackbacks/42467.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="center">
				<font size="4">
						<span style="FONT-SIZE: 18pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">第</span>
						<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">2</span>
						<span style="FONT-SIZE: 18pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">章</span>
						<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">
								<span style="mso-tab-count: 1">   </span>Sprite</span>
						<span style="FONT-SIZE: 18pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">简介</span>
				</font>
				<font size="4">
						<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /><br /></span>
						<span style="FONT-SIZE: 18pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">概述</span>
				</font>
				<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
				<font color="#3366ff">
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">Sprite(</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">精灵</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">)</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">本质上其实就是</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">MIDP</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图像。事实上，看看</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">Sprite</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">的构造函数你就能发现，</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">Sprite</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">的</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">3</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">个构造函数中有两个需要传进一个图像对象</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">(Image Object)</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">；而第三个构造函数是通过一个已经存在的</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">Sprite</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">构造</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">Sprite</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">。</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
				</font>
				<font color="#3366ff">
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">
								<br />Sprite</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">的</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">3</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">个构造函数：</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
				</font>
				<font color="#3366ff">
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-font-kerning: 0pt; mso-fareast-font-family: Wingdings">
								<span style="mso-list: Ignore">l<span style="FONT: 7pt 'Times New Roman'"><font size="3">    </font></span></span>
						</span>
						<strong>
								<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-font-kerning: 0pt">Sprite(Image image)</span>
						</strong>
						<strong>
								<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">: </span>
						</strong>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">构造一个不会动的</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">Sprite</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">；</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
				</font>
				<font color="#3366ff">
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-font-kerning: 0pt; mso-fareast-font-family: Wingdings">
								<span style="mso-list: Ignore">l<span style="FONT: 7pt 'Times New Roman'"><font size="3">    </font></span></span>
						</span>
						<strong>
								<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-font-kerning: 0pt">Sprite(Image image, int frameWidth, int frameHeight)</span>
						</strong>
						<strong>
								<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">:</span>
						</strong>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt; mso-bidi-font-weight: bold">创建一个可以动的</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt; mso-bidi-font-weight: bold">Sprite</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt; mso-bidi-font-weight: bold">；</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
				</font>
				<font color="#3366ff">
						<font size="3">
								<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-font-kerning: 0pt; mso-fareast-font-family: Wingdings">
										<span style="mso-list: Ignore">
												<font size="3">l</font>
												<span style="FONT: 7pt 'Times New Roman'">
														<font size="3">   </font>  </span>
										</span>
								</span>
								<strong>
										<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-font-kerning: 0pt">Sprite(Sprite s)</span>
								</strong>
								<strong>
										<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">: </span>
								</strong>
								<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">通过一个已经存在的</span>
								<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">Sprite</span>
								<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">构造</span>
								<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">Sprite</span>
								<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">。</span>
								<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
						</font>
				</font>
				<font size="4">
						<span style="FONT-SIZE: 18pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
								<br />精灵</span>
						<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">VS</span>
						<span style="FONT-SIZE: 18pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图像</span>
				</font>
				<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> </span>
				<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
				<font color="#3366ff">
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">精灵负责一个对象的可视化呈现。例如，你可以把</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">(</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图1</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">)</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">中的每一幅图像创建成一个精灵。</span>
						<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
				</font>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font color="#3366ff" size="3">
								<img title="图1" height="56" alt="o_1.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10403/o_1.jpg" width="257" border="0" />
								<font size="2">（图1）精灵举例</font>
						</font>
				</span>
		</p>
		<span style="FONT-SIZE: 18pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="center">
						<br />精灵的变换</p>
		</span>
		<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
		<font color="#3366ff">
				<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">尽管精灵是从图像创建来的，但是与单纯的图像相比，精灵表现出许多附件的功能。例如，精灵提供了变换</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">(transformations)</span>
				<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">功能――允许你旋转和镜像一个精灵。</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">(</span>
				<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图2</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">)</span>
				<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">展示了对精灵的几个变换：<br /></span>
		</font>
		<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
				<font color="#3366ff" size="3">
						<img height="360" alt="o_2.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10403/o_2.jpg" width="287" align="center" border="0" />
						<font size="2">（图2）精灵的变换</font>
				</font>
		</span>
		<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
		<span style="FONT-SIZE: 18pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
				<br />精灵的参考像素</span>
		<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
		<font color="#3366ff">
				<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt; mso-bidi-font-style: italic">除了变换之外，精灵的另一重要特点就是参考像素这个概念。</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt; mso-bidi-font-style: italic">
				</span>
		</font>
		<font color="#3366ff">
				<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">默认情况下，精灵的参考像素被定义在</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">(0,0)</span>
				<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">这个位置，如</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">(</span>
				<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图3</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">)</span>
				<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">所示：</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">
						<br />
				</span>
		</font>
		<font size="3">
				<font color="#3366ff">
						<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">
								<img height="94" alt="o_3.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10403/o_3.jpg" width="220" border="0" />
								<font size="2">(</font>
						</span>
						<font size="2">
								<span style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图3</span>
								<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">)</span>
								<span style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">参考像素</span>
						</font>
						<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">
								<br />
						</span>
				</font>
		</font>
		<font size="3">
				<font color="#3366ff">
						<strong>
								<span style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">注意：</span>
						</strong>
						<span style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">精灵周围的淡灰色框只是为了清晰地表现精灵的轮廓</span>
						<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">
								<br />
								<br />
						</span>
				</font>
		</font>
		<font size="3">
				<font color="#3366ff">
						<span style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">当你尝试着将精灵放置在某个特定位置但却没有参考点时，你就会发现使用参考像素的好处了。举个例子来说，在</span>
						<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">(</span>
						<span style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图4</span>
						<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">)</span>
						<span style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">中，要把一个音符的头</span>
						<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">(</span>
						<span style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">音符的圆形部分</span>
						<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">)</span>
						<span style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">放置在线上，另一个放置在两条线之间，在没有逻辑参考点的情况下，如果你愿意，可以使用参考像素位置</span>
						<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">(0,0)</span>
						<span style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">。</span>
						<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">
								<br />
								<img height="100" alt="o_4.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10403/o_4.jpg" width="249" border="0" />
						</span>
				</font>
		</font>
		<font size="2">
				<span lang="EN-US">
						<font face="Times New Roman" color="#3366ff">(</font>
				</span>
				<font color="#3366ff">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图4</span>
						<span lang="EN-US">
								<font face="Times New Roman">)</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">改变精灵的位置</span>
				</font>
		</font>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font color="#3366ff" size="3">下一板块将会演示如何用参考像素精确的解决这一问题。<br /><br /></font>
				</span>
				<span style="FONT-SIZE: 18pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">改变参考像素位置</span>
				<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
				<font color="#3366ff">
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">让我们改变音符的参考像素位置。如</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">(</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图5五</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">)</span>
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">所示：</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">
								<br />
								<img height="87" alt="o_5.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10403/o_5.jpg" width="264" border="0" />
						</span>
				</font>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">
						<font color="#3366ff">(</font>
				</span>
				<font color="#3366ff">
						<font size="3">
								<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图5</span>
								<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">)</span>
								<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">新参考像素</span>
						</font>
						<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">
								<font size="3">
										<br />
								</font>
						</span>
				</font>
				<font color="#3366ff">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">采用新的参考像素位置，把音符放到五线谱</span>
						<span lang="EN-US">
								<font face="Times New Roman">(</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">乐谱中横线的专业名称</span>
						<span lang="EN-US">
								<font face="Times New Roman">)</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的适当位置，更加直观。<br /><img height="102" alt="o_6.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10403/o_6.jpg" width="417" border="0" /></span>
				</font>
				<font size="2">
						<span lang="EN-US">
								<font face="Times New Roman" color="#3366ff">(</font>
						</span>
						<font color="#3366ff">
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图6</span>
								<span lang="EN-US">
										<font face="Times New Roman">)</font>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用参考像素改变位置<br /><br /><br /></span>
						</font>
				</font>
				<span style="FONT-SIZE: 18pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">精灵动画</span>
				<span lang="EN-US" style="FONT-SIZE: 18pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /><font color="#3366ff" size="3">与</font><font color="#3366ff"><span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图像相比，精灵的另一个好处就是能够实现动画。使用带有多帧画面的精灵</span><span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">(</span><span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">如图</span><span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">7</span><span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">所示</span><span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt">)</span><span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">，实现动画变成了简单地调用适当的方法，这些方法用于管理每一个画面按顺序显示出来从而形成动画效果的方法<br /><img height="88" alt="o_7.jpg" src="http://www.blogjava.net/images/blogjava_net/hsith/10403/o_7.jpg" width="299" border="0" /></span></font></span>
				<font size="2">
						<span lang="EN-US">
								<font face="Times New Roman" color="#3366ff">(</font>
						</span>
						<font color="#3366ff">
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图</span>
								<span lang="EN-US">
										<font face="Times New Roman">7)</font>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">精灵帧</span>
						</font>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left">
				<font size="3">
						<font color="#3366ff">
								<strong>
										<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意：</span>
								</strong>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">虽然图像也可以包含多帧画面，但是精灵拥有独特的能够简单有效地实现动画的方法。在下一章你将看到用精灵实现动画的全部细节。<br /></span>
						</font>
				</font>
				<span style="FONT-SIZE: 18pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
						<br />创建精灵</span>
				<span lang="EN-US" style="FONT-SIZE: 18pt; COLOR: black; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
				<font color="#3366ff">
						<font color="#3366ff">
								<span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">接下来，你会看到一小段代码。这段实例代码继承自</span>
								<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Arial; mso-font-kerning: 0pt">Sprite</span>
								<span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">类，它将向你展示如何创建一个精灵：</span>
						</font>
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Arial; mso-font-kerning: 0pt"> <br /></span>
				</font>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
						<font color="#3366ff">
								<br />/*-------------------------------------------------- <br /></font>
				</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
						<font color="#3366ff">* AppleSprite.java <br /></font>
				</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
						<font color="#3366ff">*-------------------------------------------------*/ <br /></font>
				</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">import javax.microedition.lcdui.game.*; <br /></span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">import javax.microedition.lcdui.*; <br /><br /></span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">public class AppleSprite extends Sprite </span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">{ <br /></span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">   public AppleSprite(Image image) </span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
						<font color="#3366ff">{ <br /></font>
				</span>
				<font color="#00ff00">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">   <font color="#339966">//</font><font color="#339966">Sprite</font></span>
						<span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
								<font color="#339966">类的构造函数</font>
						</span>
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
								<font color="#339966"> <br /></font>
						</span>
				</font>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
						<font color="#3366ff">   super(image); <br /></font>
				</span>
				<font color="#3366ff">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">   <font color="#339966">// </font></span>
						<font color="#339966">
								<span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">设置在画布上的位置</span>
								<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">...</span>
								<span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">后面将详细介绍</span>
						</font>
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt"> <br /></span>
				</font>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
						<font color="#3366ff">   setRefPixelPosition(146, 35); <br /></font>
				</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
						<font color="#3366ff">   }<br /></font>
				</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">
						<font color="#3366ff">} 
<p><font color="#3366ff"><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">假设你有一张苹果的</span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Arial; mso-font-kerning: 0pt">PNG</span><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">图片，参照下面的代码就能创建一个精灵的实例了：</span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Arial; mso-font-kerning: 0pt">  <br /></span></font><font color="#3366ff"><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">private AppleSprite spApple; // </span><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">苹果精灵</span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt"> <br /></span></font><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt"><font color="#3366ff">   ... <br /></font></span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt"><font color="#3366ff">   try </font></span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt"><font color="#3366ff">{ <br /></font></span><font color="#3366ff"><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">   // </span><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">非动画精灵</span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt"> <br /></span></font><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt"><font color="#3366ff">   spApple = new AppleSprite(Image.createImage("/apple.png")); <br /></font></span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt"><font color="#3366ff">   }catch (Exception e) </font></span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt"><font color="#3366ff">{ <br /></font></span><font color="#3366ff"><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">      System.out.println("</span><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">不能读取</span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">PNG</span><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">文件</span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">"); <br /></span></font><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Arial; mso-font-kerning: 0pt"><font color="#3366ff">   } 
<p><font color="#3366ff"><strong><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">注意：</span></strong><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Arial; mso-font-kerning: 0pt">PNG</span><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">格式是</span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Arial; mso-font-kerning: 0pt">J2ME/MIDP</span><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">支持的唯一的图像格式。要获得更多关于</span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Arial; mso-font-kerning: 0pt">PNG</span><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">文件的信息，请访问</span><span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"><a href="http://www.libpng.org/pub/png/">http://www.libpng.org/pub/png/</a></span><span style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-font-kerning: 0pt">。</span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt"></span></font></p></font></span></p><p></p><p></p><p><strong>(本文翻译自John Muchow的<em>Work with sprites in J2ME。</em>)</strong></p></font>
				</span>
		</p>
<img src ="http://www.blogjava.net/hsith/aggbug/42467.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hsith/" target="_blank">学二的猫</a> 2006-04-22 11:52 <a href="http://www.blogjava.net/hsith/archive/2006/04/22/42467.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用Sprite编写J2ME程序--第一章 开始</title><link>http://www.blogjava.net/hsith/archive/2006/04/22/42460.html</link><dc:creator>学二的猫</dc:creator><author>学二的猫</author><pubDate>Sat, 22 Apr 2006 03:19:00 GMT</pubDate><guid>http://www.blogjava.net/hsith/archive/2006/04/22/42460.html</guid><wfw:comment>http://www.blogjava.net/hsith/comments/42460.html</wfw:comment><comments>http://www.blogjava.net/hsith/archive/2006/04/22/42460.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hsith/comments/commentRss/42460.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hsith/services/trackbacks/42460.html</trackback:ping><description><![CDATA[
		<div align="center">
				<strong>
						<font color="#ff6600" size="4">第一章   开始</font>
				</strong>
				<br />
		</div>
		<p>
				<strong>
						<font size="4">关于本教程<br /></font>
				</strong>
				<font color="#3366ff" size="3">最新的MDIP2.0增加了对精灵(Sprite)的支持。精灵就是一些拥有附加属性和方法的图像，能够轻松的实现动画、变换（旋转、镜像）和碰撞检验。在本教程中，你将探索非动画精灵（nonanimated sprites）和动画精灵（animated sprites）的区别，学习使用参考像素进行精灵的布局并且讨论如何检验精灵间的碰撞。<br /><br />学习本教程期间，你将创建两个MIDlet（J2ME应用程序）。第一个将展示如何创建并显示一个动画精灵；而另一个MIDlet是一个简单的游戏，用它来阐述运行中的碰撞检验。<br /><br />当你完成本教程时，你将具备将精灵运用到你的J2ME应用程序中所必需的基本知识。<br /></font>
				<font size="4">
						<br />
						<strong>软件要求<br /></strong>
						<font color="#3366ff" size="3">1、Java Development Kit (JDK):JDK提供了Java源代码编译器和创建Java归档文件（Jar）的工具。当需要与Wireless Toolkit 2.0一起使用时，你需要下载JDK1.4版或更高版本。你可以在</font>
						<a href="http://java.sun.com/products/jdk/1.4.1">
								<font color="#3366ff" size="3">http://java.sun.com/products/jdk/1.4.1</font>
						</a>
						<font color="#3366ff" size="3">找到JDK1.4。<br /><br />2、Wireless Toolkit (WTK):Sun公司的Wireless Toolkit 是J2ME MIDlet的集成开发环境。下载下来的WTK包括一个集成开发环境（IDE）和创建MIDlet所需要的库。WTK的下载地址是：</font>
						<a href="http://java.sun.com/products/j2mewtoolkit">
								<font color="#3366ff" size="3">http://java.sun.com/products/j2mewtoolkit</font>
						</a>
						<br />
						<br />
						<strong>安装软件<br /></strong>
				</font>
				<font color="#3366ff" size="3">JDK的安装<br />使用JDK安装文件安装JDK。你可以使用默认目录也可以自己制定目录。如果你选择指定目录，那么请在安装的地方做个标记。Wireless Toolkit安装过程中会尝试着定位Java虚拟机（JVM）。如果找不到Java虚拟机，Wireless Toolkit安装程序会提示让你输入JDK安装路径。<br /><br />Wireless Toolkit（WTK）<br />Wireless Toolkit包含在一个单独的可执行可执行文件中。运行这个可执行文件开始安装Wireless Toolkit。建议你使用默认的安装路径。然而如果你不用默认目录，请确保你选择的目录不包括任何间隔。<font size="+0"><br /><br /><br /><strong>(本文翻译自John Muchow的<em>Work with sprites in J2ME。</em>)</strong></font></font>
		</p>
<img src ="http://www.blogjava.net/hsith/aggbug/42460.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hsith/" target="_blank">学二的猫</a> 2006-04-22 11:19 <a href="http://www.blogjava.net/hsith/archive/2006/04/22/42460.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>