Moto388sdk http://kb.motorola.metrowerks.com/motorola/toolshome.dojdk1.3.1 sun.comjcreator http://www.jcreator.com/download.htm
1, however, the program knows that it is running on the simulator or watching the IMEI number on the phone. Generally, the mobile phone can get the IMEI code, each phone is unique. Public void Paint (Graphics G) {g.drawstring ("Phone Parameter:", 0, 0, 16 | 4); g.drawstring ("IMEI:", 0, 30, 16 | 4); g.drawstring (System .GetProperty ("Phone.Imei"), 0, 60, 16 | 4); G.drawString ("NetWork Parameter:", 0, 90, 16 | 4); g.drawstring ("MCC:" System.getProperty ("Phone.MCC"), 0, 120, 16 | 4); g.drawstring ("MNC:" System.getProperty ("Phone.MNC"), 0, 150, 16 | 4); g.drawstring "LAI:" System.getProperty ("Phone.Lai"), 0, 180, 16 | 4); g.drawstring ("CID:" System.getProperty ("Phone.cid"), 0, 210, 16 | 4);
2 When you look at someone's Game source code, you can't find a resource (image). If you haven't added a new environment variable called J2ME_Resource_Dir, build him, the specific steps are as follows:
Under Win98: Edit the C: /autoexec.bat file, join Set J2ME_Resource_Dir = Your project directory, restart your system.
Under Win2k: My Computer - "Properties -" Advanced - Environment Variable - "System -" Add - "Name: J2ME_Resource_Dir content: Your project catalog
After matching, whenever you open in the JCREATOR, automatically turn to your J2ME_Resource_Dir specified by the directory specified.
How does the color value of 3 level four grayscale? Private final static int white_color = 0x00fffffff; private final static int Light_gray = 0x0088888; private final static int road_gray = 0x00444444; private final static int black_color = 0x00000000;
4 About the development tool Motoj2sdk is a command line development kit customized for Motorola 388 mobile phone, of course, can also be integrated with the IDE development tool to facilitate the development of users. The development environment that can be integrated includes: CodeWarrior, JCREATOR, etc.
In addition, Sun also provides Java development tools. J2ME Wireless Tookit is a simple development kit for wireless handheld devices (MDIP). If the user needs a stronger IDE development environment, then use Forte for Java CE. There is currently no 388 simulator for the development tool provided by Sun.
Java 2 SDK 1.3 is a must-have, it provides a platform for development, testing and running Java programs
I recommend JCREATOR.
5 JCREATER MOTOJ2SDK configuration and use experience hypothesis The installation path is as follows: JCREATOR D: / Program Files / XINOX Software / JCREATOR LEMOTOJ2SDK D: / MOTOJ2SDKJDK D: /JDK1.3.1
Note: To first hit the analog environment, run D: /motoj2sdk/generic/scripts/runconstructor.bat Select the phone model, select the language, select Normal, and "create".
After starting jcreater, my configuration is as follows: The first step Select configure-> options-> JDK Profiles Note: Well, create a new Profile and SELECT "D: /JDK1.3.1" change the name to "J2ME 388" Add classes PATH "D: / Motoj2sdk / lib "add documentation path" d: / motoj2sdk / docs "moves the two lines of two lines to the top.
Step 2 Select Configure-> Options-> JDK Tools Select Complier to select and Edit It. Change Parameters to -O -O -BootClassPath D: / Motoj2SDK / LIB $ [javafiles]
Step 3 Select configure-> options-> Tools Click "New" Select the DOS Command name to "preverier" to change arguments to D: /motoj2sdk/bin/preverifier.exe -classpath "D: / Motoj2sdk / lib" -d. Change Initial Directory to "$ [prjdir]"
the fourth step
Press the above method at the New a dos command name: "Run emulator" replace 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 "replace Initial Directory to" D: / Motoj2SDK / BIN "
the fifth step
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 MOST 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! Editing tools are complete!
New project - Select Empty Project to take a name, such as: TEST JCREATER Automatically generates a directory Test in your working directory Test NEW A FILE Select Java File to write your original code, save you: test.java in Project Add file and then select the Test.java you just care: Don't have packages;
Compile - "preverifier in Tools for pre-review -" Run Emulator in Tools
Example of Test.java: The function is to capture the ASCII entered by the keyboard.
Import javax.microedition.lcdui. *; import javax.microedition.midlet. *;
Public Class Test Extends Midlet imports 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 evenet * / 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 fasted * / public void command (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 designApp (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 = 0xfffffff; // White
/ *** Foreground color (i.e. the color of the rectangles) * / public final int forground_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.L.DrawString (" Key Name: " GetKeyName (LastKey), 0,3 * g .getfont (). getHeight (), graphics.top | graphics.Left);} catch (exception e) {// ignore sincest 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);}}}
6 How to respond to button messages in the primary class, this is very helpful for switching display.
// File name LWTDemomidlet.javaImport com.motorola.lwt. *; Import javax.microedition.lcdui. *; Import javax.microedition.midlet. *;
Public class lwtdemidlet extends midlet imports commandlistener {class button {
Public buttonscreen () {
// Add a Button to the screenbutton b1 = new button ("b"); /// The following code is setting button height b1.setbottomedge (Component.Height, 30);
/// The following code is the setting button width b1.seRightedge (Component.Width, 80);
/// The following code is the setting button Y coordinate, and a relative screen is the top
B1.SETTOPEDGE (Component.Screen_top, 10);
/// The following code is the setting button X coordinate relative to the previous control b1.setleftedge (Component.Previous_component_Right, 30);
Add (b1);
// add another button to the screenbutton but = new button ("Point I will line") {public void componentactuated () {show ();}}; // extend the right edge to the right edge of the screenb2.seRightetedge Component.width, 220); b2.setbottomedge (Component.Height, B2.GetPreferredHeight () * 2); add (b2); command next = new command ("next", command.ok, 1); command prev = New Command ("Previous", Command.back, 1); Addcommand (Next); Addcommand (Prev);}};
ButtonScreen screens = new ButtonScreen (); public LWTDemoMIDlet () {screens.setCommandListener (this);} protected void startApp () throws MIDletStateChangeException {Display.getDisplay (this) .setCurrent (screens);} protected void pauseApp () {} protected Void DestroyApp (Boolean Unconditional) throws MidletStateChangeException {} public void show () {system.out.println ("Get It On Main Class");
} public void command (Command C, Displayable D) {
IF (Screens == D) {// Found IT, Check Which Command Was Triggeredif (c.getCommandType () == Command.back) {system.out.println ("back");} else if (C.GetCommandType ) == command.ok) {system.out.println ("ok");} return;
}
}
7 Chinese shows, storage problems. Write Chinese into the RMS and read it again. public void openRMS () {try {recordStore = RecordStore.openRecordStore (RECORD_STORE, true);} catch (Exception e) {db (e.toString ());} System.out.println ( "RMS opened successfully!"); }
Public void closerms () {Try {recordstore.closecordStore ();} catch (e.tostring ());} system.out.println ("RMS Closed SuccessFully!");}
Public void deleterms () {if (RecordStore.ListRecordStores ()! = null) {Try {recordstore.deleteRecordStore (Record_Store);} catch (exception e) {db (e.tostring ());}} system.out.println ("RMS DELETED SUCCESSFULLLY!");} Public void write; {// string ws; // userid = inputscreen.f1.gettext (); system.out.println ("Check INPUT:" Str); // ws = new string; WriteStream (ID, str); system.out.println ("RMS WRITED SUCCESSFULLLN);} public void WriteStream (int ID, string sdata) { try {ByteArrayOutputStream strmBytes = new ByteArrayOutputStream (); DataOutputStream strmDataType = new DataOutputStream (strmBytes); byte [] record; strmDataType.writeUTF (sData); strmDataType.flush (); record = strmBytes.toByteArray (); if (recordStore.getNumRecords () == 2) RecordStore.SetRecord (ID, RECORD, 0, Record.length); Else RecordStore.AddRecord (Record, 0, Record.length);
Strmbytes.reset (); strmbytes.close (); strmdataatype.close ();} catch (eXception e) {db (e.tostring ());}
}
public void readRMS () {try {byte [] data = new byte [50]; ByteArrayInputStream strmBytes = new ByteArrayInputStream (data); DataInputStream strmDataType = new DataInputStream (strmBytes); // for (int i = 1; i <= recordStore .GETNUMRECORDS (); i ) {// RecordStore.getRecord (i, recdata, 0); // system.out.println ("Read Record:" i); // TopRecordscreen.ta1.AppendText (i " StrmDataType.readutf () "/ n"); system.out.println (RecordStore.getnumRecords ()); if (RecordStore.getnumRecords () == 2) {RecordStore.getRecord (1, DATA, 0); SCR_Choosebus. f1.setText (strmDataType.readUTF ()); System.out.println (strmDataType.readUTF ()); strmBytes.reset (); recordStore.getRecord (2, data, 0); scr_chooseBus.f2.setText (strmDataType.readUTF ()); System.out.println; strmbytes.close (); strmBytes.close (); strmDataType.close ();} catch (exception e) {db (e.tostring () ); System.out.println ("RMS Read Success");} PR Ivate Void DB (String Str) {System.err.Println ("RMS Error:" STR);}