take aim at造句:请高手逐句解释一下这个程序

来源:百度文库 编辑:高校问答 时间:2024/05/12 15:46:16
package hello;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class HelloMidlet extends MIDlet implements CommandListener {

public HelloMidlet() {
}

private Form helloForm;
private StringItem helloStringItem;
private Command exitCommand;

private void initialize() {
// Insert pre-init code here
getDisplay().setCurrent(get_helloForm());

}

public void commandAction(Command command, Displayable displayable) {
// Insert global pre-action code here
if (displayable == helloForm) {
if (command == exitCommand) {
// Insert pre-action code here
exitMIDlet();
// Insert post-action code here
}
}
// Insert global post-action code here
}

public Display getDisplay() {
return Display.getDisplay(this);
}

public void exitMIDlet() {
getDisplay().setCurrent(null);
destroyApp(true);
notifyDestroyed();
}

public Form get_helloForm() {
if (helloForm == null) {
// Insert pre-init code here
helloForm = new Form(null, new Item[] {get_helloStringItem()});
helloForm.addCommand(get_exitCommand());
helloForm.setCommandListener(this);
// Insert post-init code here
}
return helloForm;
}

public StringItem get_helloStringItem() {
if (helloStringItem == null) {
// Insert pre-init code here
helloStringItem = new StringItem("Hello", "Hello, World!");
// Insert post-init code here
}
return helloStringItem;
}

public Command get_exitCommand() {
if (exitCommand == null) {
// Insert pre-init code here
exitCommand = new Command("Exit", Command.EXIT, 1);
// Insert post-init code here
}
return exitCommand;
}

public void startApp() {
initialize();
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

}
J2EM

逐句解释?你找一本java2的入门书看一下,这段程序很简单,都是基本概念