Listing Program :
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class yuni extends MIDlet implements CommandListener {
Form Form;
Command Keluar;
Display D;
public yuni(){
Form = new Form ("Contoh Gambar");
Keluar = new Command ("Keluar", Command.EXIT,0);
Form.addCommand(Keluar);
try {
Image gambar = Image.createImage("/satu.jpg");
ImageItem tampil = new ImageItem("Gambar",gambar,Item.LAYOUT_CENTER,"keterangan");
Form.append(tampil);
} catch (Exception ex){
}
}
public void startApp() {
D=Display.getDisplay(this);
D.setCurrent(Form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command arg0, Displayable arg1) {
}
}
NB : Cara memasukkan gambar ke netbeans :
- buka gambar yang mau dimasukkan
- klik kanan => open with => Microsoft Office Picture Manager => klik Edit Pictures pada toolbar => Klik resize dipojok kanan
- isikan 10 % => OK
- Pilih File=> Save As
- My Document => NetBeansProject => Pilih Project yang anda buat => pilih folder src => ubah nama sesuai nama netbeans => lalu klik save
By : Cut Iswahyuni
Tidak ada komentar:
Posting Komentar