- 讲师:刘萍萍 / 谢楠
- 课时:160h
- 价格 4580 元
特色双名师解密新课程高频考点,送国家电网教材讲义,助力一次通关
配套通关班送国网在线题库一套
Jcreater+MotoJ2SDK的配置与使用心得
2003-04-21· ·crabtogoal··中国JAVA手机网
假设安装路径
JCreator D:"Program Files"Xinox Software"JCreator LE
motoj2sdk D:"Motoj2sdk
JDK D:"jdk1.3.1
注意:要先击活模拟环境,运行D:"MotoJ2SDK"generic"scripts"runConstructor.bat
启动Jcreater之后我的配置
选择 Configure->Options->JDK Profiles
将名字改为"J2ME 388"
Add documentation path "D:"Motoj2sdk"docs"
第二步
Options->JDK Tools
选中 and edit it.
第三步
Options->Tools
名字为"Preverifier"
将 initial directory 变为 "$[PrjDir]"
按上面的方法在New一个 DOS command
将 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"
ok!编辑工具配置完毕!
再取一个名字 比如:test
再new一个file选择java File
在Project中 选add file
注意:不要有package ;
test.java 的例子:功能是捕捉键盘输入的ascII吗。
import javax.microedition.midlet.*;
public class test extends MIDlet implements CommandListener {;
/**
*/
/**
*/
/**
*/
test() {;
myCanvas = new KeyEventsDemoCanvas();
myCanvas.setCommandListener(this);
/**
*/
};
* Start the MIDlet
protected void startApp() throws MIDletStateChangeException {; |||
};
* Pause the MIDlet
protected void pauseApp() {;
/**
*/
};
* 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.drawString("Press a key!", 0, 0, Graphics.TOP | Graphics.LEFT);
g.drawString("Key Code: " + lastKey, 0, g.getFont().getHeight(),
try {;
2 * g.getFont().getHeight(),
g.drawString("Key Name: " + getKeyName(lastKey), 0,
Graphics.TOP | Graphics.LEFT);
// ignore since alphabet keys will throw this exception
};
/**
*/
lastKey = keyCode;
};
* Demonstrate keyRepeated events
public void keyRepeated(int keyCode) {;
};
};
责编:罗莉
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
点击加载更多评论>>