download Java ME
download eclipse ME
download Java Wireless Toolkit
Setelah sudah terinstall semuanya.Kemudian buat new project dengan cara :
klik File --> New Project --> J2ME, pilih J2ME Midlet Suite --> Next --> beri nama project --> Next --> pada Dexice ganti pada DefaultColorPhone --> Finish.
Setelah project anda muncul di Project Explorer, langkah selanjutnya adalah klik kanan project anda --> pilih New --> Other --> pilih J2ME, dan pilih J2ME Midlet --> Next --> tuliskan nama class nya terserah anda --> klik Finish.
Masukkan sintaks seperti dibawah ini :
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
public class activity2 extends MIDlet implements CommandListener {
Display display;
Command exitCommand = new Command ("Exit", Command.EXIT,1);
Alert activity2Alert;
public activity2() {
activity2Alert = new Alert("Hello Midlet","Hello world", null, AlertType.INFO);
activity2Alert.setTimeout (Alert.FOREVER);
activity2Alert.addCommand (exitCommand);
activity2Alert.setCommandListener (this);
}
protected void startApp() {
if (display == null) {
display = Display.getDisplay(this);
}
display.setCurrent(activity2Alert);
}
public void pauseApp() {
}
public void destroyApp (boolean unconditional) {
}
public void commandAction (Command c, Displayable d) {
if (c == exitCommand) {
destroyApp(true);
notifyDestroyed();
}
}
}
Hasil Screenshot setelah dijalankan
0 comments:
Post a Comment