Pertemuan 1
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class adam extends MIDlet implements
CommandListener {
Alert tampil;
Display layar;
Ticker jalan;
public adam(){
tampil=new
Alert("Projek awal","Hai",null,AlertType.ALARM);
jalan=new
Ticker("Helb");
tampil.setTicker(jalan);
tampil.setCommandListener(this);
}
public void
startApp() {
layar=Display.getDisplay(this);
layar.setCurrent(tampil);
}
public void
pauseApp() {
}
public void
destroyApp(boolean unconditional) {
}
public void
commandAction(Command arg0, Displayable arg1) {
}
}
Pertemuan 2
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Menu extends MIDlet implements CommandListener{
Display D;
Alert a,b;
Ticker r;
Command K,C1,C2,B;
Image h;
public Menu(){
try{
h =
Image.createImage("/3.jpg");
}catch(Exception e){e.printStackTrace();}
a=new
Alert("Menu Utama",null,h,null);
b=new
Alert("Profil",null,null,null);
r=new
Ticker("Hello");
K=new
Command("Keluar",Command.EXIT,0);
C1=new
Command("Profil",Command.OK,0);
C2=new
Command("Objek Wisata",Command.OK,1);
B=new
Command("Kemabali",Command.BACK,0);
a.setTicker(r);
a.addCommand(C1);
a.addCommand(C2);
a.addCommand(K);
a.setTimeout(Alert.FOREVER);
a.setCommandListener(this);
}
public void
startApp() {
D=Display.getDisplay(this);
D.setCurrent(a);
}
public void
commandAction (Command x,Displayable arg1){
if(x==K){
destroyApp(true);
notifyDestroyed();
}
if(x==C1){
b.setTicker(r);
b.addCommand(C1);
b.addCommand(C2);
b.addCommand(B);
b.setTimeout(Alert.FOREVER);
b.setCommandListener(this);
D.setCurrent(b);
}
if(x==B){
D.setCurrent(a);
}
}
public void
pauseApp(){
}
public void
destroyApp(boolean unconditional) {
}
}
Pertemuan 3
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class gambar extends MIDlet implements
CommandListener {
Image
g,g1,g2,g3,g4;
Display D;
Form fr,fr1;
Alert a;
List ls;
Command S,B,B1;
public gambar (){
try {g = Image.createImage("/1.jpg");
g1=
Image.createImage("/2.jpg");
g2=
Image.createImage("/3.jpg");
g3=
Image.createImage("/4.jpg");
g4=
Image.createImage("/5.jpg");
} catch
(Exception e){e.printStackTrace();}
S = new
Command ("OK",Command.OK,0);
B = new
Command ("BACK",Command.BACK,0);
B1 = new
Command ("BACK",Command.BACK,1);
fr = new Form
("halaman awal");
fr.append("selamat datang \n");
fr.append(g);
fr.append("tekan OK untuk
melanjutkan");
fr.addCommand(S);
fr.setCommandListener(this);
fr1= new Form
("gambar1");
fr.append(g1);
fr.append("tuliskan apa saja tentang gambar");
fr.addCommand(B1);
fr.setCommandListener(this);
a= new
Alert("pemberitahuan","data kosong",g4,AlertType.INFO);
a.addCommand(B1);
a.setCommandListener(this);
a.setTimeout(Alert.FOREVER);
ls= new List
("album",List.IMPLICIT);
ls.append("gambar1", null);
ls.append("gambar2",null);
ls.append("gambar3", null);
ls.addCommand(B);
ls.setCommandListener(this);
}
public void
startApp() {
D=
Display.getDisplay(this);
D.setCurrent(fr);
}
public void
pauseApp() {
}
public void
destroyApp(boolean unconditional) {
}
public void
commandAction(Command x, Displayable arg1) {
if (x==
ls.SELECT_COMMAND){
int i=
ls.getSelectedIndex();
String
p=ls.getString(i);
if
(p=="gambar1"){
D.setCurrent(fr1);}
else
{D.setCurrent(a);}
}
if (x== S){
D.setCurrent(ls);
}
if (x== B1){
D.setCurrent(ls);
}
if (x== B){
D.setCurrent(fr);}
}
}


