Contenu connexe Similaire à Jeni slides j2 me-02-memulai pemrograman mobile (20) Jeni slides j2 me-02-memulai pemrograman mobile5. Hello, World! MIDlet
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloMidlet extends MIDlet
implements CommandListener {
Display display;
Command exitCommand =
new Command("Exit", Command.EXIT, 1);
Alert helloAlert;
6. Hello, World! MIDlet
public HelloMidlet(){
helloAlert = new Alert(
"Hello MIDlet", "Hello, world!",
null, AlertType.INFO
);
helloAlert.setTimeout(Alert.FOREVER);
helloAlert.addCommand(exitCommand);
helloAlert.setCommandListener(this);
}
7. Hello, World! MIDlet
public void startApp() {
if (display == null){
display =
Display.getDisplay(this);
}
display.setCurrent(helloAlert);
}
11. Membuat Project
File -> New Project
Category: Mobile
Project: Mobile Application
Tentukan nama project
Pilih platform
13. Membuat MIDlet
File -> New File...
Category: MIDP
File Type: MIDlet
Tentukan nama MIDlet
Tuliskan kode untuk MIDlet