Download Program EXE |
KALKULATOR
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class proses extends MIDlet implements CommandListener {
Display layar;
Ticker t;
Form f;
TextField bil1,bil2,hasil,ket;
Command keluar,kali,bagi,tambah,kurang;
public proses(){
t=new Ticker ("Selamat Siang");
f=new Form ("Kalkulator");
bil1=new TextField ("Bilangan 1","",7,TextField.NUMERIC);
bil2=new TextField ("Bilangan 2","",7,TextField.NUMERIC);
hasil=new TextField ("Hasil","",10,TextField.ANY);
ket=new TextField ("Keteangan","",30,TextField.ANY);
keluar=new Command ("Exit",Command.EXIT,0);
kali=new Command ("Kali",Command.OK,1);
bagi=new Command ("Bagi",Command.OK,2);
tambah=new Command ("Tambah",Command.OK,3);
kurang=new Command ("Kurang",Command.OK,4);
f.append(bil1);
f.append(bil2);
f.append(hasil);
f.append(ket);
f.addCommand(keluar);
f.addCommand(kali);
f.addCommand(bagi);
f.addCommand(tambah);
f.addCommand(kurang);
f.setTicker(t);
f.setCommandListener(this);
}
public void startApp() {
layar=Display.getDisplay(this);
layar.setCurrent(f);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command arg0, Displayable arg1) {
if(arg0==keluar){
destroyApp(true);
notifyDestroyed();
}
if(arg0==kali){
int b1,b2,h;
String ket1="";
b1=Integer.parseInt(bil1.getString());
b2=Integer.parseInt(bil2.getString());
h=b1*b2;
hasil.setString(String.valueOf(h));
if(b1>b2){
ket1="Bil1 lebih besar daripada Bil2";
}
if(b1
}
if(b1==b2){
ket1="Bil1 sama dengan Bil2";
}
ket.setString(ket1);
}
}
}
UserID
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Id extends MIDlet implements CommandListener {
Display layar;
Ticker tiker;
Form fm;
Alert a;
TextField password,user,nama,alamat;
Command keluar,lanjut,kembali,kembali2,ayah,ibu,kakak,saya,adik;
ChoiceGroup Jkelamin,pendidikan,kwn;
public Id(){
tiker=new Ticker ("Selamat Pagi");
fm=new Form ("Menu Login");
user=new TextField ("User_ID","",10,TextField.ANY);
password=new TextField ("No_Pin ","",10,TextField.PASSWORD);
nama=new TextField ("Nama","",10,TextField.ANY);
alamat=new TextField ("Alamat","",10,TextField.ANY);
Jkelamin=new ChoiceGroup ("Jkelamin",ChoiceGroup.POPUP);
pendidikan=new ChoiceGroup ("Pendidikan",ChoiceGroup.EXCLUSIVE);
kwn=new ChoiceGroup ("Kewarganegaraan",ChoiceGroup.POPUP);
lanjut=new Command ("Lanjut",Command.OK,0);
keluar=new Command ("Keluar",Command.EXIT,0);
kembali=new Command ("Kembali",Command.EXIT,0);
kembali2=new Command ("Kembali",Command.EXIT,0);
ayah=new Command ("Ayah",Command.OK,1);
ibu=new Command ("Ibu",Command.OK,2);
kakak=new Command ("Kakak",Command.OK,3);
saya=new Command ("Saya",Command.OK,4);
adik=new Command ("Adik",Command.OK,5);
fm.append(user);
fm.append(password);
fm.addCommand(lanjut);
fm.addCommand(keluar);
fm.setTicker(tiker);
fm.setCommandListener(this);
}
public void startApp() {
layar=Display.getDisplay(this);
layar.setCurrent(fm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command arg0, Displayable arg1) {
if(arg0==keluar){
destroyApp(true);
notifyDestroyed();
}
if(arg0==lanjut){
if(user.getString().equals("Emtik")){
if(password.getString().equals("123456")){
fm=new Form ("Data Keluarga");
fm.addCommand(ayah);
fm.addCommand(ibu);
fm.addCommand(kakak);
fm.addCommand(saya);
fm.addCommand(adik);
fm.addCommand(kembali);
fm.setCommandListener(this);
layar=Display.getDisplay(this);
layar.setCurrent(fm);
}
}
}
if(arg0==ayah){
fm=new Form ("Data Ayah");
nama=new TextField ("Nama :","",10,TextField.ANY);
alamat=new TextField ("Alamat :","",15,TextField.ANY);
Jkelamin=new ChoiceGroup ("Jkelamin",ChoiceGroup.POPUP);
Jkelamin.append("Laki-laki", null);
Jkelamin.append("Perempuan", null);
pendidikan=new ChoiceGroup ("Pendidikan",ChoiceGroup.EXCLUSIVE);
pendidikan.append("S1", null);
pendidikan.append("S2", null);
pendidikan.append("S3", null);
kwn=new ChoiceGroup ("Kewarganegaraan",ChoiceGroup.POPUP);
kwn.append("WNI", null);
kwn.append("WNA", null);
fm.append(nama);
fm.append(alamat);
fm.append(Jkelamin);
fm.append(pendidikan);
fm.append(kwn);
fm.addCommand(kembali2);
fm.setCommandListener(this);
layar=Display.getDisplay(this);
layar.setCurrent(fm);
}
if(arg0==kembali){
tiker=new Ticker ("Selamat Pagi");
fm=new Form ("Menu Login");
user=new TextField ("User_ID","",10,TextField.ANY);
password=new TextField ("No_Pin","",6,TextField.PASSWORD);
lanjut=new Command ("Lanjut",Command.OK,0);
keluar=new Command ("Keluar",Command.EXIT,0);
fm.append(user);
fm.append(password);
fm.addCommand(lanjut);
fm.addCommand(keluar);
fm.setTicker(tiker);
fm.setCommandListener(this);
layar=Display.getDisplay(this);
layar.setCurrent(fm);
}
if(arg0==kembali2){
fm=new Form ("Data Keluarga");
fm.addCommand(ayah);
fm.addCommand(ibu);
fm.addCommand(kakak);
fm.addCommand(saya);
fm.addCommand(adik);
fm.addCommand(kembali);
fm.setCommandListener(this);
layar=Display.getDisplay(this);
layar.setCurrent(fm);
}
}
}
Welcome to Bhenika
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Id extends MIDlet implements CommandListener {
Display lcd;
Ticker tkr;
Alert al;
Form fm;
Command kembali,kembali2,keluar,masuk,komputer,printer,acsesoris;
TextField cari, email,komentar;
ChoiceGroup merek, type, harga;
public Id() {
tkr=new Ticker ("LATIHAN");
al=new Alert ("TOKO KOMPUTER","Welcome to Bhineka.com",null,AlertType.INFO);
masuk=new Command ("Masuk",Command.OK,0);
keluar=new Command ("Keluar",Command.EXIT,0);
al.setTicker(tkr);
al.addCommand(masuk);
al.addCommand(keluar);
al.setTimeout(Alert.FOREVER);
al.setCommandListener(this);
}
public void startApp() {
lcd=Display.getDisplay(this);
lcd.setCurrent(al);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command arg0, Displayable arg1) {
if(arg0==keluar){
destroyApp(true);
notifyDestroyed();
}
if(arg0==masuk){
fm=new Form("Menu");
tkr=new Ticker("Daftar Produk");
komputer=new Command("Komputer",Command.OK,0);
printer=new Command("Printer",Command.OK,0);
acsesoris=new Command("Acsesoris",Command.OK,0);
kembali=new Command("Kembali",Command.EXIT,0);
fm.setTicker(tkr);
fm.addCommand(komputer);
fm.addCommand(printer);
fm.addCommand(acsesoris);
fm.addCommand(kembali);
fm.setCommandListener(this);
lcd=Display.getDisplay(this);
lcd.setCurrent(fm);
}
if(arg0==kembali){
tkr=new Ticker ("LATIHAN");
al=new Alert ("TOKO KOMPUTER","Welcome to\n Bhineka.com",null,AlertType.INFO);
masuk=new Command ("Masuk",Command.OK,0);
keluar=new Command ("Keluar",Command.EXIT,0);
al.setTicker(tkr);
al.addCommand(masuk);
al.addCommand(keluar);
al.setTimeout(Alert.FOREVER);
al.setCommandListener(this);
lcd=Display.getDisplay(this);
lcd.setCurrent(al);
}
if(arg0==komputer){
fm=new Form("Komputer");
cari=new TextField("Cari","",10,TextField.ANY);
email=new TextField("E-Mail","",20,TextField.ANY);
merek=new ChoiceGroup("Merek",Choice.EXCLUSIVE);
merek.append("Acer",null);
merek.append("Toshiba",null);
merek.append("HP",null);
type=new ChoiceGroup("Type",Choice.POPUP);
type.append("Laptop",null);
type.append("Netbook",null);
harga=new ChoiceGroup("Harga",Choice.TEXT_WRAP_OFF);
harga.append("1 Juta",null);
harga.append("2 Juta",null);
harga.append("3 Juta",null);
kembali2=new Command("Kembali",Command.OK,0);
fm.append(cari);
fm.append(merek);
fm.append(type);
fm.append(harga);
fm.append(email);
fm.addCommand(kembali2);
fm.setCommandListener(this);
lcd=Display.getDisplay(this);
lcd.setCurrent(fm);
}
if(arg0==kembali2){
fm=new Form("Menu");
tkr=new Ticker("Daftar Produk");
komputer=new Command("Komputer",Command.OK,0);
printer=new Command("Printer",Command.OK,0);
acsesoris=new Command("Acsesoris",Command.OK,0);
kembali2=new Command("Kembali",Command.EXIT,0);
fm.setTicker(tkr);
fm.addCommand(komputer);
fm.addCommand(printer);
fm.addCommand(acsesoris);
fm.addCommand(kembali);
fm.setCommandListener(this);
lcd=Display.getDisplay(this);
lcd.setCurrent(fm);
}
if(arg0==printer){
fm=new Form("Printer");
merek=new ChoiceGroup("Merek",Choice.POPUP);
merek.append("HP", null);
merek.append("Canon", null);
type=new ChoiceGroup("Type",Choice.EXCLUSIVE);
type.append("Laser", null);
type.append("Inkjet", null);
harga=new ChoiceGroup("Harga",Choice.TEXT_WRAP_OFF);
harga.append("600.000", null);
harga.append("1.000.000", null);
harga.append("2.000.000", null);
komentar=new TextField("Komentar","",10,TextField.ANY);
kembali2=new Command("Kembali",Command.OK,0);
fm.append(merek);
fm.append(type);
fm.append(harga);
fm.append(komentar);
fm.addCommand(kembali2);
fm.setCommandListener(this);
lcd=Display.getDisplay(this);
lcd.setCurrent(fm);
}
}
}
Berikan Komentar tentang Artikel Ini