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>
?
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 閱讀(173) 評論(0) 編輯 收藏 所屬分類: 轉載