Mobile Computing - Lab Activity III

Kali ini saya akan upload kembali tugas dari mata kuliah Mobile Computing. Tugas berjudul Lab Activity ke-3 ini tentang Membuat Form. Berikut sintax untuk membuatnya:

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;



public class textfield extends MIDlet implements CommandListener{
Display display;
Form textForm;
Command exitCommand = new Command ("Exit", Command.EXIT, 1);
Command saveCommand = new Command ("Save", Command.OK, 1);
DateField dateonly, timeonly, datetime;
ChoiceGroup choiceExclusive;
Ticker ticker = new Ticker("Hendra Satria - 5302410101");

public textfield() {
textForm = new Form("TextField Types");
textForm.addCommand(exitCommand);
textForm.setCommandListener(this);
TextField NAMA = new TextField("Masukkan Nama", "", 64, TextField.ANY);
choiceExclusive = new ChoiceGroup("Gender", Choice.POPUP);
choiceExclusive.append("Laki-laki", null);
choiceExclusive.append("Perempuan", null);
TextField ALAMAT = new TextField("Masukkan Alamat", "", 64, TextField.ANY);
TextField PHONENUMBER = new TextField("Masukkan Nomor Telp", "", 64, TextField.PHONENUMBER);
TextField EMAIL = new TextField("Masukkan Email", "", 64, TextField.EMAILADDR);
DateField dateonly = new DateField("Tanggal Lahir ", DateField.DATE);
textForm.append(NAMA);
textForm.append(choiceExclusive);
textForm.append(ALAMAT);
textForm.append(PHONENUMBER);
textForm.append(EMAIL);
textForm.append(dateonly);
textForm.setTicker(ticker);
}
public void startApp(){
if (display == null){
display = Display.getDisplay(this);
display.setCurrent(textForm);
}
}
public void pauseApp (){
}
public void destroyApp(boolean unconditional){
}
public void commandAction(Command c, Displayable d){
if (c == exitCommand){
destroyApp(true);
notifyDestroyed();
}
if (c == saveCommand){

}
}
}

Hasil ScreenShoot:


Terima kasih.. ^_^

0 comments:

Post a Comment