import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author LAB10
*/
public class MenuUtama extends MIDlet implements CommandListener{
Display d;
klassMenu ok;
Form f;
StringItem siBP, siNama, sialamat, siAgama, siStatus;
Command cmdBack;
public MenuUtama()
{
d=Display. getDisplay(this);
ok=new klassMenu(this);
}
public void startApp() {
d.setCurrent(ok);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
void notifyDestroyed(boolean b) {
}
public void commandAction(Command c, Displayable d) {
}
public void tampilkan(){
String BP;
BP="10101152630076";
String Nama;
Nama="Auliya Rahman";
String Alamat;
Alamat="Padang";
String Agama;
Agama="Islam";
String Status;
Status="Mahasiswa";
f=new Form("Form Data Diri");;
siBP=new StringItem("No BP :", BP);
siBP.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD|Font.STYLE_UNDERLINED,Font.SIZE_MEDIUM));
siNama=new StringItem("nama :", Nama);
siNama.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD|Font.STYLE_UNDERLINED,Font.SIZE_MEDIUM));
sialamat=new StringItem("Alamat : ",Alamat);
sialamat.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD|Font.STYLE_UNDERLINED,Font.SIZE_MEDIUM));
siAgama=new StringItem("Agama:",Agama);
siAgama.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD|Font.STYLE_UNDERLINED,Font.SIZE_MEDIUM));
siStatus=new StringItem("Status:", Status);
siStatus.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD|Font.STYLE_UNDERLINED,Font.SIZE_MEDIUM));
cmdBack=new Command("Kembali",Command.BACK,0);
f.addCommand(cmdBack);
f.append(siBP);
f.append(siNama);
f.append(siStatus);
f.append(sialamat);
f.append(siAgama);
f.setCommandListener(this);
d.setCurrent(f);
}
}
2.//kanfas nya//
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class klassMenu extends Canvas implements CommandListener{
MenuUtama menu;
Command cmdKeluar, cmdMasuk;
Image img;
public klassMenu(MenuUtama tampilan){
this.menu=tampilan;
cmdKeluar=new Command("Keluar",Command.EXIT, 0);
cmdMasuk=new Command("Masuk",Command.OK, 1);
addCommand(cmdKeluar);
addCommand(cmdMasuk);
setCommandListener(this);
}
public void paint(Graphics g){
g.setColor(0,255,0);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(255, 0, 0);
g.drawString("foto-foto saya", 120,250, Graphics.HCENTER|Graphics.TOP);
try {
Image image = Image.createImage("/00111.jpg");
g.drawImage(image,120,160,Graphics.HCENTER | Graphics.TOP);
} catch (Exception e){}
try {
Image image = Image.createImage("/00111.jpg");
g.drawImage(image,30,30,Graphics.HCENTER | Graphics.TOP);
} catch (Exception e){}
try {
Image image = Image.createImage("/012.jpg");
g.drawImage(image,200,30,Graphics.HCENTER | Graphics.TOP);
} catch (Exception e){}
}
public void commandAction(Command c, Displayable r) {
if(c==cmdKeluar){
menu.destroyApp(true);
menu.notifyDestroyed(true);
}else if(c==cmdMasuk){
menu.tampilkan();
}
}
}