Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure and use Jcreater+MotoJ2SDK

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you "how to configure and use Jcreater+MotoJ2SDK", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to configure and use Jcreater+MotoJ2SDK" this article.

Suppose the installation path is as follows:

JCreator D:Program FilesXinox SoftwareJCreator LE

Motoj2sdk D:Motoj2sdk

JDK D:jdk1.3.1

Note: to activate the simulation environment, run D:MotoJ2SDKgenericscripts unConstructor.bat

Select the phone model, select the language, select normal, and then "create".

After starting Jcreater, my configuration is as follows:

Select Configure- > Options- > JDK Profiles in the first step

Note: be sure to create a new profile and select "D:jdk1.3.1"

Change the name to "J2ME 388"

Add classes path "D:Motoj2sdklib"

Add documentation path "D:Motoj2sdkdocs"

Move the following two lines to the top respectively.

Select Configure- > Options- > JDK Tools in the second step

Select Complier

Select and edit it.

Change parameters to-classpath D:/motoj2sdk/lib $[JavaFiles]

Step three

Select Configure- > Options- > Tools

Click "New" to select DOS command

The name is "Preverifier".

Replace arguments with d:Motoj2sdkinpreverifier.exe-classpath "d:Motoj2sdklib"-d. .

Change initial directory to "$[PrjDir]"

Step 4

Follow the above method to New a DOS command

Name: "Run Emulator"

Replace arguments with "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 with "d:Motoj2sdkin"

Ok! The editing tool has been configured!

Build a new project? Select Empty Project

Give it another name, such as: test

Then jcreater automatically generates directory test in your working directory

Then new a file and choose java File.

Write your original code and save it such as: test.java

Select add file in Project

Then select your test.java just now.

Note: no package

Compile "Preverifier in tools for pre-audit" Run Emulator in tools to simulate

Example of test.java: is the function to capture keyboard input 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 ("KeyName:" + 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)

}

}

}

The above is all the contents of the article "how to configure and use Jcreater+MotoJ2SDK". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report