Write a mobile phone program Please use JCREATOR PRO

zhaozj2021-02-17  57

Write Motorola's mobile phone program, please use JCREATOR LE V 2.00

JCREATOR LE V 2.00

XINOX Software's Free Java Integrated Development Environment

Http://www.jcreator.com/download.htm can download

The interface of jcreater! Is very similar to VC, so it is easier to get started, but the English explanation is easy to use, so I have studied it myself!

I write two .bat files

Explain, my packing is as follows:

JCREATOR C: / Program Files / XINOX Software / JCREATOR LE

Motoj2sdk C: / Motoj2sdk

JDK C: /JDK1.3

1) coml.bat // files in C: / Motoj2sdk / Demo / MIDlets must not change the directory

The content is as follows:

@IF not "% 1" == "" SET compileClass =% 1

@IF "% 1" == "" SET CompileClass = C: / Motoj2SDK / DEMO / MIDLETS / COM / MOT / J2ME / MIDLETS / PADdleBall / *. Java C: / Motoj2SDK / DEMO / MIDLETS / COM / MOT / J2ME / MIDLETS / TESTS / *. Java

@echo compling ...

@echo off

Javac -o -bootclasspath C: / Motoj2SDK / LIB% compileClass%

@echo preverifying ...

@echo off

C: / Motoj2sdk / bin / preverifier -classpath c: / motoj2sdk / lib -d.

The content is over.

CompileClass is a directory to be compiled multiple available space intervals

2) Go.bat // File in C: / Motoj2sdk / Scripts must not change the directory

The content is as follows:

@echo is running the simulator ...

@echo on

Set myclass = com.mot.j2me.midlets.tests.soundtest

Cd ../bin

C: /jdk1.3/bin/java -djava.library.path = C: / Motoj2sdk / lib -classpath c: /motoj2sdk/bin/emulator.jar; c: /motoj2sdk/bin/configtool.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 is you want to run files, here we have chosen com.mot.j2me.midlets.tests.Soundtest

Some examples in the SDK below, we can run. (As long as myclass is changed to the lower value)

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

GraphicsDemocom.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.keyeventstestst

Textboxtest

com.mot.j2me.midlets.tests.textboxtest

TextFieldTest

com.mot.j2me.midlets.tests.textfieldtest

Tickertest

com.mot.j2me.midlets.tests.tickertest

Write two files we can run the program!

Run the coml.bat first, then run Go.bat

As shown below.

So how do we combine it with JCREATER? ?

1 See the picture below Select Configure-> Options-> Tools

This will be written with JCReater! My email: sunyuzhe@263.net welcomes you! Suppose the installation path is as follows: JCREATOR D: / program files / xinox software / jcreator lemotoj2sdk d: / motoj2sdkjdk d: /jdk1.3.1 Note: To first attack the analog environment, run d: /motoj2sdk/generic/scripts/runconstructor.bat selection Mobile phone model, select 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 rows to the top. Second steps Select Configure-> Options-> JDK Tools Select Complier Select

And Edit IT.

Change Parameters to -ClassPath 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. To change Initial Directory to "$ [prjDir]" Step 4 to press the above method in 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 the initial directory to" D: / Motoj2sdk / bin "OK! Editing tool configuration! 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 then selects the Test.java you just cared: Don't have package; "Preverier in Tools for pre-review -" Run Emulator in Tools Monate Test.java: Function is the ASCII input to the keyboard .

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 * / viVate 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 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 {/ *** b ackground color (ie the color of the screen) * / public final int BACKGROUND_COLOR = 0xFFFFFF; // white / *** Foreground color (ie 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, 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.LrawString ("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 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);}}} This may be JCReater combines writing programs!

My email: sunyuzhe@263.net welcomes you!

转载请注明原文地址:https://www.9cbs.com/read-29231.html

New Post(0)