Ada 3 jenis List yaitu : IMPLICIT, EXCLUCIVE, MULTIPLE. List.IMPLICIT memungkinkan pengguna langsung mendapat respon begitu memilih satu elemen. List.EXCLUSIVE mengijinkan pengguna memilih hanya satu pilihan tetapi tidak memberikan respon langsung ketika suatu elemen dipilih. List.MULTIPLE mengijinkan pengguna memilih lebih dari satu pilihan.
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author programmer dekil
*/
public class Midlet extends MIDlet implements CommandListener{
private Display display;
private List list;
private Command cmdKeluar;
private Command cmdKembali;
private Command cmdLanjut;
private Form form;
public Midlet() {
form = new Form("Lowongan");
cmdKeluar = new Command("Keluar", Command.EXIT, 0);
cmdKembali = new Command("Kembali", Command.BACK, 1);
}
public void startApp() {
display = Display.getDisplay(this);
display.setCurrent(form);
menuList();
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
notifyDestroyed();
}
public void menuList(){
list = new List("Lowongan", List.IMPLICIT);
list.append("Programmer", null);
list.append("System Analist", null);
list.append("GUI Desinger", null);
list.append("Database Administrator", null);
list.append("Network Administrator", null);
list.append("Technical Support", null);
list.addCommand(cmdKeluar);
list.setCommandListener(this);
display.setCurrent(list);
}
public void programmer(){
form = new Form("Programmer");
StringItem strPro;
strPro = new StringItem("Syarat :", "1. Ijazah S1
Informatika");
form.append(strPro);
form.addCommand(cmdKembali);
display.setCurrent(form);
}
public void systemAnalist(){
form = new Form("System Analist");
StringItem strSys;
strSys = new StringItem("Syarat :", "1. Ijazah S2
Teknik");
form.append(strSys);
form.addCommand(cmdKembali);
display.setCurrent(form);
}
public void commandAction(Command c, Displayable d) {
if (c == cmdKeluar){
destroyApp(true);
}else if (c == cmdKembali){
menuList();
}else{
List menu = (List) display.getCurrent();
switch (menu.getSelectedIndex()){
case 0:
programmer();
break;
case 1:
systemAnalist();
break;
}
}
}
}
List.IMPLICIT |
List.EXCLISIVE |
List.MULTIPLE |
0 komentar:
Posting Komentar