Listing Program :
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Aplikasi_Jadwal extends MIDlet implements CommandListener {
Form Futama,F1,F2,F3,F4;
List list_menu;
Display Layar;
Ticker t;
Command kembali1,kembali2,kembali3,kembali4,keluar;
Command H1,H2,H3,H4,H5,H6,H7;
public Aplikasi_Jadwal(){
H1 = new Command ("Jadwal",Command.OK,0);
H2 = new Command ("Dosen",Command.OK,1);
keluar = new Command ("Keluar",Command.EXIT,0);
t = new Ticker ("Aplikasi Jadwal Kuliah");
Futama = new Form ("Halaman Aplikasi");
Futama.append("Pilih menu untuk : \n - Jadwal \n - Dosen");
Futama.addCommand(H1);
Futama.addCommand(H2);
Futama.addCommand(keluar);
Futama.setTicker(t);
Futama.setCommandListener(this);
t = new Ticker ("Aplikasi Jadwal Kuliah");
kembali1 = new Command ("Back",Command.BACK,0);
list_menu = new List("Hari Jadwal Perkuliahan",List.IMPLICIT);
list_menu.append("Senin",null);
list_menu.append("Selasa",null);
list_menu.append("Rabu",null);
list_menu.append("Kamis",null);
list_menu.append("Jum'at",null);
list_menu.append("Sabtu",null);
list_menu.addCommand(kembali1);
list_menu.setTicker(t);
list_menu.setCommandListener(this);
kembali2 = new Command ("Back",Command.BACK,0);
t = new Ticker ("Aplikasi Jadwal Kuliah");
F1 = new Form("Jadwal Hari Kamis");
F1.append("Mobile Programming \n08.15 s/d 10.30");
F1.addCommand(kembali2);
F1.setTicker(t);
F1.setCommandListener(this);
}
public void startApp() {
Layar = Display.getDisplay(this);
Layar.setCurrent(Futama);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command C, Displayable D) {
if (C==keluar){
destroyApp(true);
notifyDestroyed();
}
if(C==H1){
Layar.setCurrent(list_menu);
}
if(C==H2){
Layar.setCurrent(F1);
}
if (C==kembali1){
Layar.setCurrent(Futama);
}
if (C==kembali2){
Layar.setCurrent(list_menu);
}
if(C==List.SELECT_COMMAND){
int i=list_menu.getSelectedIndex();
String S =list_menu.getString(i);
if(S=="Kamis"){
Layar.setCurrent(F1);
}
}
}
}
By : Cut Iswahyuni
Tidak ada komentar:
Posting Komentar