Tuesday, December 11, 2012
Membuat help dalam MIDlet pada JAVA (J2ME)
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class OnlineHelp extends MIDlet
implements CommandListener {
private Display display;
private List list;
private Form form;
private String help = "Ini adalah contoh teks panjang " +
"yang akan digunakan " +
"sebagai teks bantuan/help " +
"dalam penggunaan aplikasi.";
private final Command cmdKeluar =
new Command("Keluar", Command.EXIT, 1);
private final Command cmdHelp =
new Command("Help", Command.HELP, 1);
private final Command cmdKembali =
new Command("Kembali", Command.BACK, 1);
public OnlineHelp() {
display = Display.getDisplay(this);
list = new List("Bahasa Favorit", Choice.MULTIPLE);
list.append("Java", null);
list.append("C", null);
list.append("C++", null);
list.append("Pascal", null);
list.addCommand(cmdKeluar);
list.addCommand(cmdHelp);
list.setCommandListener(this);
}
public void startApp() {
display.setCurrent(list);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
if (c == cmdKeluar) {
destroyApp(false);
notifyDestroyed();
} else if (c == cmdHelp) {
form = new Form("Online-Help");
form.append(help);
form.addCommand(cmdKembali);
form.setCommandListener(this);
display.setCurrent(form);
} else {
display.setCurrent(list);
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment