| ¥N
¦Ò Áp ¨t |
|
Mail: |
| PassBiBle |
 |
PassBiBle.Com |
| Msn
: |
| PassBiBle |
 |
HotMail.Com |
| QQ
: 6411019 |
|
 |
| |
|
Jcreater+MotoJ2SDKªº°t¸mÉO¨Ï¥Î¤ß±o
|
| |
°²³]¦w¸Ë¸ô®|¦p¤U¡G
JCreator D:\Program Files\Xinox Software\JCreator LE
¡@¡@ motoj2sdk D:\Motoj2sdk
¡@¡@ JDK D:\jdk1.3.1
¡@¡@ ª`·N¡Gn¥ýÀ»¬¡¼ÒÀÀÀô¹Ò¡A¹B¦æD:\MotoJ2SDK\generic\scripts\runConstructor.bat
¡@¡@ ¿ï¾Ü¤âÉ󫬸¹¡A¿ï¾Ü»y¨¥¡A¿ï¾Ünormal¡A ¦A"³Ð«Ø"¡C
¡@¡@ ±Ò°ÊJcreater¤§¦Z§Úªº°t¸m¦p¤U¡G
¡@¡@ ²Ä¤@¨B
¡@¡@ ¿ï¾Ü Configure->Options->JDK Profiles
¡@¡@ ª`·N¡G¤@©w·s«Ø profile and select ¡§D:\jdk1.3.1¡¨
¡@¡@ ±N¦W¦r§ï¬°¡§J2ME 388¡¨
¡@¡@ Add classes path ¡§D:\Motoj2sdk\lib¡¨
¡@¡@ Add documentation path ¡§D:\Motoj2sdk\docs¡¨
¡@¡@ ¤À§O±N¦Z¥[ªº¨â¦æ²¾¨ì³Ì¤W¤è.
¡@¡@ ²Ä¤G¨B
¡@¡@ ¿ï¾Ü Configure->Options->JDK Tools
¡@¡@ ¿ï¾ÜComplier ¿ï¤¤ and edit it.
¡@¡@ ±N parameters Åܬ° -classpath D:/motoj2sdk/lib $[JavaFiles] ¡@¡@ ²Ä¤T¨B
¡@¡@ ¿ï¾Ü Configur
e->Options->Tools
¡@¡@ ÂIÀ»¡§New¡¨¿ï¾Ü DOS command
¡@¡@ ¦W¦r¬°¡§Preverifier¡¨
¡@¡@ ±N arguments ´«¬° d:\Motoj2sdk\bin\preverifier.exe -classpath "d:\Motoj2sdk\lib" -d . .
¡@¡@ ±N initial directory Åܬ° ¡§$[PrjDir]¡¨
¡@¡@ ²Ä4¨B
¡@¡@ «ö¤W±ªº¤èªk¦bNew¤@Ó DOS command
¡@¡@ ¦W¦r¡G¡§Run Emulator¡¨
¡@¡@ ±N arguments ´«¦¨ ¡§java -Djava.library.path=d:/MotoJ2SDK/lib -classpath "d:/MotoJ2SDK/bin/Emulator.jar"¡F"d:/MotoJ2SDK/ConfigTool.jar" com.mot.tools.j2me.emulator.Emulator -classpath$[PrjDir]¡F"d:/MotoJ2SDK/lib" -deviceFile d:/MotoJ2SDK/bin/resources/device.props javax.microedition.midlet.AppManager $[CurClass] -JSA 1 1¡¨
¡@¡@ ±N initial directory ´«¦¨ ¡§d:\Motoj2sdk\bin¡¨
¡@¡@ ok!½s¿è¤u¨ã°t¸m§¹²¦¡I
¡@¡@ ·s«Ø¤@Ó¤uµ{¡X¡X¿ï¾ÜEmpty Project
¡@¡@ ¦A¨ú¤@Ó¦W¦r ¤ñ¦p¡Gtest
¡@¡@ «hjcreater¦Û°Ê¦b§Aªº¤u§@¥Ø¿ý¤¤¥Í¦¨¥Ø¿ýtest
¡@¡@ ¦Anew¤@Ófile¿ï¾Üjava File
¡@¡@ ¼g¦n§Aªºì¥N½X¡A«O¦s ¦p¡Gtest.java
¡@¡@ ¦bProject¤¤ ¿ïadd file
¡@¡@ µM¦Z¿ï¤¤§Aè¤~ªºtest.java
¡@¡@ ª`·N¡G¤£n¦³package ¡F
¡@¡@ ½sĶ¡X¡X¡ntools¤¤ªºPreverifier¶i¦æ¹w¥ý¼f®Ö¡X¡X¡ntools¤¤ªºRun Emulator¶i¦æ¼ÒÀÀ
¡@¡@ test.java ªº¨Ò¤l¡G¥\¯à¬O®·®»Áä½L¿é¤JªºascII¶Ü¡C
¡@¡@ import javax.microedition.lcdui.*¡F
¡@¡@ import javax.microedition.midlet.*¡F
¡@¡@ public class test extends MIDlet implements CommandListener {¡F
¡@¡@ /**
¡@¡@ * The screen for this MIDlet
¡@¡@ */ ¡@¡@ private KeyEventsDemoCanvas myCanvas¡F
¡@¡@ /**
¡@¡@ * Reference to current Display
¡@¡@ */
¡@¡@ private Display myDisplay¡F
¡@¡@ /**
¡@¡@ * Command to make sure soft key is not a key event
¡@¡@ */ ¡@¡@ private Command okCommand = new Command¡]"OK", Command.OK, 1¡^¡F
¡@¡@ test¡]¡^ {¡F
¡@¡@ myDisplay = Display.getDisplay¡]this¡^¡F
¡@¡@ myCanvas = new KeyEventsDemoCanvas¡]¡^¡F
¡@¡@ myCanvas.addCommand¡]okCommand¡^¡F
¡@¡@ myCanvas.setCommandListener¡]this¡^¡F
¡@¡@ }¡F /**
¡@¡@ * Do nothing if a command is fired ¡@¡@ */
¡@¡@ public void commandAction¡]Command c, Displayable s¡^ {¡F
¡@¡@ }¡F
¡@¡@ /**
¡@¡@ * Start the MIDlet
¡@¡@ */
¡@¡@ protected void startApp¡]¡^ throws MIDletStateChangeException {¡F
¡@¡@ myDisplay.setCurrent¡]myCanvas¡^¡F
¡@¡@ }¡F
¡@¡@ /**
¡@¡@ * Pause the MIDlet
¡@¡@ */
¡@¡@ protected void pauseApp¡]¡^ {¡F
¡@¡@ }¡F
¡@¡@ /**
¡@¡@ * Called by the framework before the application is unloaded
¡@¡@ */ ¡@¡@ protected void destroyApp¡]boolean unconditional¡^ {¡F
¡@¡@ }¡F
¡@¡@ /** <
BR>¡@¡@ * The screen for this application
¡@¡@ */
¡@¡@ class KeyEventsDemoCanvas extends Canvas {¡F
¡@¡@ /**
¡@¡@ * Background color ¡]i.e. the color of the screen¡^
¡@¡@ */
¡@¡@ public final int BACKGROUND_COLOR = 0xFFFFFF¡F // white
¡@¡@ /**
¡@¡@ * Foreground color ¡]i.e. the color of the rectangles¡^
¡@¡@ */
¡@¡@ public final int FOREGROUND_COLOR = 0x000000¡F // black
¡@¡@ /**
¡@¡@ * Last key that was pressed ¡@¡@ */
¡@¡@ private int lastKey¡F
¡@¡@ /**
¡@¡@ * Paint the screen
¡@¡@ */
¡@¡@ public void paint¡]Graphics g¡^ {¡F
¡@¡@ /*
¡@¡@ * Clear the screen
¡@¡@ */
¡@¡@ g.setColor¡]BACKGROUND_COLOR¡^¡F
¡@¡@ g.fillRect¡]0, 0, getWidth¡]¡^, getHeight¡]¡^¡^¡F
¡@¡@ /*
¡@¡@ * Paint the message
¡@¡@ */
¡@¡@ g.setColor¡]FOREGROUND_COLOR¡^¡F
¡@¡@ g.drawString¡]"Press a key!", 0, 0, Graphics.TOP | Gra
phics.LEFT¡^¡F
¡@¡@ if ¡]lastKey != 0¡^ {¡F
¡@¡@ g.drawString¡]"Key Code: " + lastKey, 0, g.getFont¡]¡^.getHeight¡]¡^,
¡@¡@ Graphics.TOP | Graphics.LEFT¡^¡F
¡@¡@ try {¡F
¡@¡@ g.drawString¡]"Action: " + getGameAction¡]lastKey¡^, 0,
¡@¡@ 2 * g.getFont¡]¡^.getHeight¡]¡^,
¡@¡@ Graphics.TOP | Graphics.LEFT¡^¡F
¡@¡@ g.drawString¡]"Key Name: " + getKeyName¡]lastKey¡^, 0,
¡@¡@ 3 * g.getFont¡]¡^.getHeight¡]¡^,
¡@¡@ Graphics.TOP | Graphics.LEFT¡^¡F
¡@¡@ }¡F catch ¡]Exception e¡^ {¡F
¡@¡@ // ignore since alphabet keys will throw this exception
¡@¡@ }¡F
¡@¡@ }¡F
¡@¡@ }¡F ¡@¡@ /**
¡@¡@ * Handle key press
¡@¡@ */
¡@¡@ public void keyPressed¡]int keyCode¡^ {¡F
¡@¡@ lastKey = keyCode¡F
¡@¡@ repaint¡]¡^¡F
¡@¡@ }¡F
¡@¡@ /**
¡@¡@ * Demonstrate keyRepeated events
¡@¡@ */
¡@¡@ public void keyRepeated¡]int keyCode¡^ {¡F
¡@
¡@ System.out.println¡]"Key repeated " + keyCode¡^¡F
¡@¡@ }¡F
¡@¡@ }¡F
¡@¡@ }¡F
|
|
|