随笔 - 2, 文章 - 10, 评论 - 3, 引用 - 0
数据加载中……

polish samples的说明(初学很不错)

需要:

jdk,wtk就不用说了.

下载j2mepolish :
http://www.j2mepolish.org/downloads/j2mepolish-1.2.4.html#download

直接双击jar文件(java -jar j2mepolish-1.2.4.jar)根据向导安装即可,很简单.

在eclipse中运行samples里面的menu例子.

拷贝 ${polish.home}/samepse/menu到eclipse的工作目录.

然后建立一个java工程名为 menu (会自动导入拷过来的menu里面的src,res等等)

直接ant运行build脚本即可生成jar,jad文件(会发现有很多版本,不同语言,不同平台,不同midp版本的)

要配置生成哪些版本,或者平台的jar,jad,可以在build.xml里面配置,如下位置:

<deviceRequirements unless="test">
  <requirement name="Identifier" value="Nokia/Series60, Nokia/Series60Midp2, Generic/midp2, Generic/midp1" />
  <!-- on could use other devices for real builds, e.g. :
  <or>
  <and>
  <requirement name="JavaPackage" value="nokia-ui" />
  <requirement name="BitsPerPixel" value="16+" />
  </and>
  </or>
  -->
</deviceRequirements>

语言(默认有德文和英文)可以在如下位置配置:(我把德文改称了中文)

<resources
  dir="resources"
  defaultexcludes="yes"
  excludes="readme.txt"
  >
  <!-- you can add resources based on complex criterias:
  <fileset
  dir="resources/multimedia"
  includes="*.wav"
  if="polish.audio.wav"
  />
  <fileset
  dir="resources/multimedia"
  includes="*.mid"
  if="polish.audio.midi and not polish.audio.wav"
  />
  -->
  <!-- add the localization element for created localized
      versions of your application: -->
  <localization locales="cn,en_US" unless="test" />
  <localization locales="en_US" if="test" />
  </resources>

注意,如果配置了一个cn的话,要在resources里面添加一个messages_cn.txt

内容可以如下:

#######################################
#                         #
#   This file contains translations   #
#   of the application.           #
#   Key and Value are separated     #
#   by the equals-sign "=".       #
#                         #
#######################################

# You can also define localized preprocessing variables here, by starting the
# definition with "var:". Variables defined here will override the ones defined
# in the <variables>-section of your build.xml.
# Variables starting with "polish." or "MIDlet-" don't need to start with "var:"
# by the way.
var:MyExampleVariable=你好,midlet
var:GameName=测试

# Setting J2ME Polish variables:
polish.command.ok=确认
polish.command.cancel=取消
polish.command.select=选择
polish.command.options=选项

# It's also possible to set MIDlet-attributes for your JAD- and MANIFEST-files here.
# If you like you can start them with "var:" as well, but it is not needed.
# Again MIDlet-attributes defined override the one defined in the <info>-
# and <jad>-sections of your build.xml
MIDlet-Description=中文哦
MIDlet-Name=J2ME Polish Beispiel
MIDlet-Delete-Confirm=J2ME Polish




# Setting appplication specific translations:

cmd.StartGame=${GameName} 开始
cmd.Quit=退出
cmd.ShowLog=log 显示

menu.StartGame=${GameName} 开始!
menu.LoadGame=${GameName} 读取
menu.Highscore=最高分
menu.Quit=退出
#menu.go=出发

messages.welcome=欢迎阿, {0}!!!



=========================================

这个时候在dist目录下生成了中文的不同平台和midp版本的jad,jar文件

用模拟器运行即可看到效果

如果要在ant的时候就打开模拟器运行,修改一下build.xml的如下地方:

<target name="init">
  <property name="test" value="true" /> //改为true
<property name="dir.work" value="build/real" />
<property name="deploy-url" value="" />
</target>

配置模拟器的地方:(不需要修改,我修改是不想看到内存和网络监视的那些东西)

<emulator
  wait="true"
  trace="class"
  securityDomain="trusted"
  enableProfiler="false"   //默认true的,我改称了false
  enableMemoryMonitor="false" //默认true的,我改称了false

  enableNetworkMonitor="false" //默认true的,我改称了false

  if="test"
  >
  <!--
  <parameter name="-Xjam" value="transient=http://localhost:8080/${polish.jadName}" />
  -->
</emulator>

 

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1178720

posted on 2006-09-23 10:03 Alex 阅读(170) 评论(0)  编辑  收藏 所属分类: 转载


只有注册用户登录后才能发表评论。


网站导航: