 |
MOTO手机开发的问题汇总
日期:2004-4-26 0:01:18 作者:rocks 文档类型:原创 来自:蓝色理想数码站 |
|
|
5 Jcreater+MotoJ2SDK的配置与使用心得
假设安装路径如下: JCreator D:\Program Files\Xinox Software\JCreator LE motoj2sdk D:\Motoj2sdk JDK D:\jdk1.3.1
注意:要先击活模拟环境,运行D:\MotoJ2SDK\generic\scripts\runConstructor.bat 选择手机型号,选择语言,选择normal, 再"创建"。
启动Jcreater之后我的配置如下: 第一步 选择 Configure->Options->JDK Profiles 注意:一定新建 profile and select “D:\jdk1.3.1” 将名字改为“J2ME 388” Add classes path “D:\Motoj2sdk\lib” Add documentation path “D:\Motoj2sdk\docs” 分别将后加的两行移到最上方.
第二步 选择 Configure->Options->JDK Tools 选择Complier 选中 and edit it. 将 parameters 变为 -O -bootclasspath D:/motoj2sdk/lib $[JavaFiles]
第三步 选择 Configure->Options->Tools 点击“New”选择 DOS command 名字为“Preverifier” 将 arguments 换为 d:\Motoj2sdk\bin\preverifier.exe -classpath "d:\Motoj2sdk\lib" -d . . 将 initial directory 变为 “$[PrjDir]”
第四步
按上面的方法在New一个 DOS command 名字:“Run Emulator” 将 arguments 换成 “java -Djava.library.path=d:/MotoJ2SDK/lib -classpath "d:/MotoJ2SDK/bin/Emulator.jar";"d:/MotoJ2SDK/ConfigTool.jar" com.mot.tools.j2me.emulator.Emulator -classpath$[PrjDir];"d:/MotoJ2SDK/lib" -deviceFile d:/MotoJ2SDK/bin/resources/device.props javax.microedition.midlet.AppManager $[CurClass] -JSA 1 1” 将 initial directory 换成 “d:\Motoj2sdk\bin”
第五步
New DOS command “Create Jar”
Change arguments to “"$[JavaHome]\bin\jar.exe" cvfM $[PrjName].jar META-INF\MANIFEST.MF *.CLASS *.png”
Change initial directory to “$[PrjDir]”
NOTE: You must add META-INF\MANIFEST.MF in the project
NOTE: You must change the directory “com/mot/project/*.CLASS” when you create your project.
NOTE: If you have resource files, you should also add these files into jar file, 1 folder is not necessary.
ok!编辑工具配置完毕!
新建一个工程——选择Empty Project 再取一个名字 比如:test 则jcreater自动在你的工作目录中生成目录test 再new一个file选择java File 写好你的原代码,保存 如:test.java 在Project中 选add file 然后选中你刚才的test.java
注意:不要有package ;
编译——》tools中的Preverifier进行预先审核——》tools中的Run Emulator进行模拟
test.java 的例子:功能是捕捉键盘输入的ascII吗。
import javax.microedition.lcdui.*; import javax.microedition.midlet.*;
public class test extends MIDlet implements CommandListener {
/** * The screen for this MIDlet */ private KeyEventsDemoCanvas myCanvas;
/** * Reference to current Display */ private Display myDisplay;
/** * Command to make sure soft key is not a key event */ private Command okCommand = new Command("OK", Command.OK, 1);
test() {
myDisplay = Display.getDisplay(this); myCanvas = new KeyEventsDemoCanvas(); myCanvas.addCommand(okCommand); myCanvas.setCommandListener(this); }
/** * Do nothing if a command is fired */ public void commandAction(Command c, Displayable s) { }
/** * Start the MIDlet */ protected void startApp() throws MIDletStateChangeException {
myDisplay.setCurrent(myCanvas); }
/** * Pause the MIDlet */ protected void pauseApp() { }
/** * Called by the framework before the application is unloaded */ protected void destroyApp(boolean unconditional) { }
/** * The screen for this application */ class KeyEventsDemoCanvas extends Canvas {
/** * Background color (i.e. the color of the screen) */ public final int BACKGROUND_COLOR = 0xFFFFFF; // white
/** * Foreground color (i.e. the color of the rectangles) */ public final int FOREGROUND_COLOR = 0x000000; // black
/** * Last key that was pressed */ private int lastKey;
/** * Paint the screen */ public void paint(Graphics g) {
/* * Clear the screen */ g.setColor(BACKGROUND_COLOR); g.fillRect(0, 0, getWidth(), getHeight());
/* * Paint the message */ g.setColor(FOREGROUND_COLOR);
g.drawString("Press a key!", 0, 0, Graphics.TOP | Graphics.LEFT);
if (lastKey != 0) { g.drawString("Key Code: " + lastKey, 0, g.getFont().getHeight(), Graphics.TOP | Graphics.LEFT); try { g.drawString("Action: " + getGameAction(lastKey), 0, 2 * g.getFont().getHeight(), Graphics.TOP | Graphics.LEFT); g.drawString("Key Name: " + getKeyName(lastKey), 0, 3 * g.getFont().getHeight(), Graphics.TOP | Graphics.LEFT); } catch (Exception e) { // ignore since alphabet keys will throw this exception } } }
/** * Handle key press */ public void keyPressed(int keyCode) {
lastKey = keyCode; repaint(); }
/** * Demonstrate keyRepeated events */ public void keyRepeated(int keyCode) { System.out.println("Key repeated " + keyCode); } } }
|
| 蓝色理想数码站版权申明:除部分特别声明不要转载,或者授权我站独家播发的文章外,大家可以自由转载我站点的原创文章,但原作者和来自我站的链接必须保留(非我站原创的,按照原来自一节,自行链接)。文章版权归我站和作者共有。
转载要求:转载之图片、文件,链接请不要盗链到本站,且不准打上各自站点的水印,亦不能抹去我站点水印。
特别注意:本站所提供的摄影照片,相关评测,如需使用,请与原作者联系,版权归原作者所有
|
|
 |
· 谈音质标准与音质评价方法
· MP3维修知识经验总结
· 数码相机简易自制立体影像
· 数码照片拍摄用光经验谈
· 手机游戏下载完全实用攻略
· SP智能手机使用IA资源管理器快捷键汇总
· 了解智能手机的操作系统们
· 手机游戏下载完全实用攻略 · SP智能手机使用IA资源管理器快捷键汇总 · 了解智能手机的操作系统们 · 免费WAP风起云涌 移动未来谁主? · [香港] 结束等待!索爱Z800i行货正式开卖 · 小心你的手机也中毒! · 手机常见九大故障自我排除法 · 16个手机相关名词释疑 · 主流无线传输技术GPRS与CDMA对比 · GPRS服务详细介绍
|