当前页面: 开发资料首页 → J2ME 专题 → J2ME开发步骤
摘要: J2ME开发步骤
/*
* HelloWorld.java
*
* June 27, 2000
*
* ? Copyright 2000 Motorola, Inc. All Rights Reserved.
* This notice does not imply publication.
*/
package com.mot.j2me.midlets.tutorials;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
/**
* A simple Hello World midlet
*
* @see MIDlet
*/
public class HelloWorld extends MIDlet {
/**
* Main application screen
*/
private Form mainScreen;
/**
* A reference to the Display
*/
private Display myDisplay;
/**
* Creates a screen for our midlet
*/
HelloWorld() {
myDisplay = Display.getDisplay(this);
mainScreen = new Form("Hello World");
/*
* Create a string item
*/
StringItem strItem = new StringItem("Hello", "This is a J2ME MIDlet.");
mainScreen.append(strItem);
}
/**
* Start the MIDlet
*/
public void startApp() throws MIDletStateChangeException {
myDisplay.setCurrent(mainScreen);
}
/**
* Pause the MIDlet
*/
public void pauseApp() {
}
/**
* Called by the framework before the application is unloaded
*/
public void destroyApp(boolean unconditional) {
}
}