import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.midlet.MIDlet;
public class CreatingFormWithItems extends MIDlet implements CommandListener {
private Display display;
private Form form;
private Command exit = new Command("Exit", Command.SCREEN, 1);
// membuat sebuah command public CreatingFormWithItems() {
display = Display.getDisplay(this);
StringItem messages[] = new StringItem[] { new StringItem("Welcome, ", "glad you could come."),
new StringItem("Hello, ", "Mary.") };
//membuat strin item yang akan dimasukkan kedalam sebuah form form = new Form("Display Form with Items", messages);
//membuat form, dan memasukkan string item messages kedalam form ini form.addCommand(exit);
//menambahkan command kedalam form form.setCommandListener(this);
}
public void startApp() {
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command command, Displayable displayable) {
if (command == exit) {
destroyApp(true);
notifyDestroyed();
//merupakan action dari command exit }
}
}
sumber : www.java2s.com
Diatas merupakan source code contoh untuk membuat form.
print out :
Senin, 17 Mei 2010
Langganan:
Posting Komentar (Atom)
Pengikut
Category
- B.indonesia (26)
- cyber crime (8)
- cyber law (1)
- Database (1)
- Grafik (2)
- it audit (1)
- jaringan (4)
- nasional (1)
- Pemograman (2)
- Pemrograman Java (8)
- Pengelolaan Proyek Sistem Informasi (2)
- sosial (2)
- Telematika (2)
0 komentar:
Posting Komentar