快捷搜索:

写摩托罗拉公司的手机程序请用JCreator LE v 2.00

JCreator LE v 2.00

Xinox软件公司的免费Java集成开拓情况

http://www.jcreator.com/Download.htm 可下载

JCreater!的界面与vc的十分相似,以是对照轻易上手,然则按网止给的英文阐明却好用了,于是自己着手钻研了一下!

我写两个.bat的文件

阐明一下,我的按装如下:

JCreatorC:Program FilesXinox SoftwareJCreator LE

motoj2sdkC:Motoj2sdk

JDKC:jdk1.3

1 ) coml.bat//文件在C:MotoJ2SDKdemomidlets 必然不要改目录

内容如下:

@if NOT "%1"=="" set COMPILECLASS=%1

@if"%1"=="" set COMPILECLASS=C:MotoJ2SDKdemomidletscommotj2memidletspaddleball*.java C:MotoJ2SDKdemomidletscommotj2memidlets ests*.java

@echo Compiling ...

@echo off

javac -O -bootclasspath C:MotoJ2SDKlib %COMPILECLASS%

@echo Preverifying ...

@echo off

C:MotoJ2SDKinpreverifier -classpath C:MotoJ2SDKlib -d . .

内容完了

COMPILECLASS 是要编译的目录 多个可用空格距离

2 ) go.bat//文件在C:MotoJ2SDKscripts 必然不要改目录

内容如下:

@echo 正在运行模拟器 ...

@echo on

set MYCLASS=com.mot.j2me.midlets.tests.SoundTest

cd ..in

C:jdk1.3injava -Djava.library.path=C:MotoJ2SDKlib -classpath C:MotoJ2SDKinEmulator.jar;C:MotoJ2SDKinConfigTool.jar com.mot.tools.j2me.emulator.Emulator -classpath../demo/midlets;../lib -deviceFile resources/device.props javax.microedition.midlet.AppManager %MYCLASS% -JSA 1 1

cd ..scripts

@echo on

MYCLASS 是你要运行文件,这里我们选了com.mot.j2me.midlets.tests.SoundTest

下面sdk 中的一些例子,我们可以运行。(只要把MYCLASS改为如下值)

Bounce

com.mot.j2me.midlets.bounce.Bounce

PaddleBall

com.mot.j2me.midlets.paddleball.PaddleBall

Scribble

com.mot.j2me.midlets.scribble.Scribble

FontDemo

com.mot.j2me.midlets.tutorials.FontDemo

GraphicsDemo

com.mot.j2me.midlets.tutorials.GraphicsDemo

RecordStoreDemo

com.mot.j2me.midlets.tutorials.RecordStoreDemo

UDP Tutorial Application

com.mot.j2me.midlets.tutorials.UDPReceive

AlertTest

com.mot.j2me.midlets.tests.AlertTest

ChoiceGroupTest

com.mot.j2me.midlets.tests.ChoiceGroupTest

DateFieldTest

com.mot.j2me.midlets.tests.DateFieldTest

FormTest

com.mot.j2me.midlets.tests.FormTest

GaugeTest

com.mot.j2me.midlets.tests.GaugeTest

KeyEventsTest

com.mot.j2me.midlets.tests.KeyEventsTest

TextBoxTest

com.mot.j2me.midlets.tests.TextBoxTest

TextFieldTest

com.mot.j2me.midlets.tests.TextFieldTest

TickerTest

com.mot.j2me.midlets.tests.TickerTest

写完两个文件我们就可以运行法度榜样了!

先运行coml.bat,再运行go.bat

如下图。

那么我们怎么把它与jcreater结合呢??

1见下图Select Configure->Options->Tools

这样就可以与jcreater结合写法度榜样了!

我的Email:sunyuzhe@263.net迎接与大年夜家评论争论!

假设安装路径如下:

JCreator D:Program FilesXinox SoftwareJCreator LE

motoj2sdk D:Motoj2sdk

JDK D:jdk1.3.1

留意:要先击活模拟情况,运行D:MotoJ2SDKgenericscriptsunConstructor.bat

选择手机型号,选择说话,选择normal, 再"创建"。

启动Jcreater之后我的设置设置设备摆设摆设如下:

第一步 选择 Configure->Options->JDK Profiles

留意:必然新建 profile and select “D:jdk1.3.1”

将名字改为“J2ME 388”

Add classes path “D:Motoj2sdklib”

Add documentation path “D:Motoj2sdkdocs”

分手将后加的两行移到最上方.

第二步 选择 Configure->Options->JDK Tools

选择Complier

选中 and edit it.

将 parameters 变为 -classpath D:/motoj2sdk/lib $[JavaFiles]

第三步

选择 Configure->Options->Tools

点击“New”选择 DOS command

名字为“Preverifier”

将 arguments 换为 d:Motoj2sdkinpreverifier.exe -classpath "d:Motoj2sdklib" -d . .

将 initial directory 变为 “$[PrjDir]”

第4步

按上面的措施在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:Motoj2sdkin”

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);

}

}

}

这样就可以与jcreater结合写法度榜样了!

我的Email:sunyuzhe@263.net迎接与大年夜家评论争论!

您可能还会对下面的文章感兴趣: