package MobileApplication2;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class MobileApplication2 extends MIDlet implements CommandListener{
private Command exit;
private Command back;
private Command save;
private Command done;
private Command opening;
private Command comment;
private Form fm;
private List lst;
private TextBox tb;
private Display d;
//contructor
public MobileApplication2(){
d = Display.getDisplay(this);
fm = new Form("TAMPILAN AWAL = AGUNAWAN CE-6A");
tb = new TextBox("Tulis Komentar", null, 500, 0);
lst = new List("Pesan pembuka", List.IMPLICIT);
lst.append("SELAMAT DATANG DI POLITEKNIK NEGERI MEDAN", null);
exit = new Command("Exit", Command.EXIT,1);
back = new Command("Back", Command.BACK,1);
save = new Command("save", Command.OK,1);
done = new Command("done", Command.OK,1);
comment = new Command("Tulis Komentar", Command.OK, 2);
opening = new Command("Pesan pembuka", Command.OK, 1);
fm.addCommand(exit);
fm.addCommand(comment);
fm.addCommand(opening);
tb.addCommand(back);
tb.addCommand(save);
lst.addCommand(back);
lst.addCommand(done);
fm.setCommandListener(this);
tb.setCommandListener(this);
lst.setCommandListener(this);
}
public void startApp() {
d.setCurrent(fm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable dd) {
if(c == exit){
destroyApp(false);
notifyDestroyed();
}
else if(c == opening){
Alert al = new Alert("Pesan pembuka");
al.setString("Mohon tunggu sebentar untuk melihat pesan pembuka");
d.setCurrent(al, lst);
}
else if(c == comment){
Alert al = new Alert("Simpan komentar");
al.setString("Mohon tunggu untuk menulis komentar");
al.setType(AlertType.INFO);
d.setCurrent(al, tb);
}
else if(c == back){
d.setCurrent(fm);
}
else if(c == save){
Alert al = new Alert("Perhatian");
al.setString("Komentar telah berhasil disimpan");
al.setType(AlertType.INFO);
d.setCurrent(al, fm);
}
else if(c == done){
Alert al = new Alert("Loading");
al.setType(AlertType.INFO);
d.setCurrent(al, fm);
}
}
}
Dibawah ini adalah tampilan aplikasi yang sudah dijalankan
1. Tampilan awal.
2. Tampilan Pesan pembuka.
3. Tampilan Komentar.
Tidak ada komentar:
Posting Komentar