- Buka Netbean
- Membuat project baru à pilih “Mobile”à “Mobile Application”
- Beri nama project baru dan tentukan lokasi penyimpanannya <hilangkan tanda centang pada “Create Hello MIDlet”, karena kita akan membuat MIDlet nantinya
- Kemudian Memilih Platform
- Kemudian Membuat sebuah MIDlet à Memberi nama MIDlet
- Kemudian Menuliskan Source Code nya sesuai contoh
>
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
public class Hello extends MIDlet implements CommandListener {
Display display;
Command exitCommand = new Command ("Exit", Command.EXIT,1);
Alert helloAlert;
public Hello() {
helloAlert = new Alert("Hello Midlet","Hello world!", null, AlertType.INFO);
helloAlert.setTimeout (Alert.FOREVER);
helloAlert.addCommand (exitCommand);
helloAlert.setCommandListener (this);
}
protected void startApp() {
if (display == null) {
display = Display.getDisplay(this);
}
display.setCurrent(helloAlert);
}
public void pauseApp() {
}
public void destroyApp (boolean unconditional) {
}
public void commandAction (Command c, Displayable d) {
if (c == exitCommand) {
destroyApp(true);
notifyDestroyed();
}
}
}
<
8. Lalu run MIDlet yang kita buat di Emulator yang
disediakan
Gb: Screenshoot hasil running
MIDlet nya
Sekian dam terima kasih J

0 comments:
Post a Comment