Just write something

xiaoxiao2021-03-06  21

There are Think in Java on your hands and MIDP2.0 documents downloaded from Sun, learning. But I can't help but write something to get the sense of sense of sensibility and entry for Java development. Ha ha. Ready to do two things to practice, mainly for the two examples provided by http://www.j2medev.com/. Codes and creativity are purely practiced by others. The first is that the tank war is Tony is a man insisted on 60s (air war). Note: My annotations and description are completely unregulated according to their own understanding. :) Step 1: Create a J2ME MIDET project, there are several concepts that need to be written here for easy understanding. You can know, don't ask too much, huh, huh. 1. What is MIDP? Move Information Device Description (MIDP) is a set of Java Application Programming Interfaces (APIs), which provides a complete Java application running environment with mobile information devices such as cellular phones together with a limited connection device configuration (CONNECTED DEVICE Configuration - CLDC). Applications for MIDPD Java devices must be written in MIDP JAVA. The PJAVA application cannot run on the MIDP Java device. 2. What is KVM? - Chaozi: It is actually a simulator of a mobile environment, which is used to test your Java program. The full name of KVM is K Virtual Machine (K virtual machine - K is Qian: "kilo"). KVM is a special application of Java virtual machine compliant with CLDC specifications. 3. What is MIDLET? - chaozi: It is obvious to implement this interface to let your Java program run on the phone. MIDlet is a MIDP application running on supporting MIDP devices. MIDlet uses only APIs defined by MIDP and CLDC specification. It is also an interface in the MIDP Midiet API package. Step 2: The project is built. In the first step, I said that I need to implement the MIDLET interface, so we create a MIDlet extension. The name Gamemidlet system generates the necessary code for us, and we only need to make some modifications, you can use the completed code as follows.

Import javax.microedition.midlet. *; // introduce MIDLET, expand people, of course,

Import javax.microedition.lcdui. *; // Introduced LCDUI, STD, LCD: LCD Display UI: User Interface

Public Class Gamemidlet Extends MIDLET

{

Private display display;

Public void startApp ()

{

Display = display.getdisplay (this);

Tankgamecanvas gamecanvas = new tankgamecanvas (); // This thing is the extension Gamecanvas class we write, with the basic logic of the game. In the later articles, you will introduce if you don't have javax.microedition.lcdui.game This guy indicates that your MIDP version is too old.

Gamecanvas.start (); // Haha, the game started.

Display.setCurrent (Gamecanvas); // Show it out

}

Public Display getDisplay ()

{

Return Display;

}

Public void pauseApp ()

{

}

Public void destroyApp (boolean unconditional) {

SYSTEM.GC ();

NotifyDestroyed ();

}

}

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

New Post(0)