Langka-langkah
11. Buka netbeans -> file -> new project ->
pilih kategori java ME dan project mobile aplication
12. Kemudian Next dan isikan pada project name nama
project anda, misal hallo
13. Kita Next lagi dan pilih device configuration
pilih CLDC-1.1 dan device profile MIDP-2.1
14. Kemudian ketikkan scrip berikut
import javax.microedition.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);
}
public 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();
}
}
}
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);
}
public 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();
}
}
}
15. Hasil setelah di run pada emulator









Leave a Reply