Thursday, January 23, 2014

TUGAS PEMBUATAN FORM CHECK IN TAMU HOTEL DENGAN PEMOGRAMAN MOBILE J2ME


  1. Script programnya :


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package hari2;


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




/**
* @author jaheodak
*/
public class Midlet_tugas extends MIDlet implements CommandListener{
Form form;
//Gauge gauge;
Spacer spacer;
TextField txtField;
// DateField dateField;
StringItem stringItem;
ChoiceGroup choiceGroup;
public Midlet_tugas (){
form = new Form("Chekin Tamu Hotel");
txtField = new TextField("Nama :", "", 50, TextField.ANY);
form.append(txtField);
txtField = new TextField("No.Telp :","",50,TextField.PHONENUMBER);
form.append(txtField);
txtField = new TextField("Email :","",50, TextField.EMAILADDR);
form.append(txtField);
txtField = new TextField("Deposit (Rp) :","",18, TextField.ANY);
form.append(txtField);
choiceGroup = new ChoiceGroup("Lunas ? ", ChoiceGroup.EXCLUSIVE,
new String[] {"Ya", "Tidak"}, null);
form.append(choiceGroup);
spacer = new Spacer(20, 20);
form.append(spacer);
try{
Image img = Image.createImage("/za.jpg");
ImageItem image = new ImageItem("By Hotel AKPRIND",
img, Item.LAYOUT_CENTER, "cool");
form.append(image);
}
catch(Exception e){}
form.addCommand(new Command("EXIT", Command.EXIT, 0));
form.addCommand(new Command("HELP", Command.HELP, 1));
form.addCommand(new Command("SIMPAN", Command.OK, 2));
form.setCommandListener(this);
}
public void startApp() {
Display display = Display.getDisplay(this);
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
String label = c.getLabel();
if("EXIT".equals(label)) {
notifyDestroyed();
}
else if ("HELP".equals(label)) {
help();
}
else if ("OK".equals(label)) {
processform();
}
else if ("BALIK".equals(label)) {
startApp();
}
}


public void help(){
Form fhelp = new Form("Pertolongan");
fhelp.append("Pertolongan Pertama... \nPertolongan Kedua");
Display.getDisplay(this).setCurrent(fhelp);
fhelp.addCommand(new Command("BALIK", Command.BACK, 2));
fhelp.setCommandListener(this);
}
public void processform(){
Form fok = new Form("Hasil");
fok.append("Data Telah Disimpan");
Display.getDisplay(this).setCurrent(fok);
fok.addCommand(new Command("Balik", Command.BACK, 1));
fok.setCommandListener(this);
}
}

//}