RSS

Membuat Tulisan Berjalan, Teks Alamat dan Menampilkan Gambar pada J2ME

 Ketikkan Program berikut pada textpad dan simpan dengan nama "SOMidlet".

import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class SOMidlet extends MIDlet implements CommandListener {
private Display display;
private Form form, login;
private Ticker ticker;
private Command Start, exit, back;
private Image img;
private ImageItem img2;
private TextField tf_Username;
private TextField tf_Password;
public SOMidlet(){
form = new Form("");
ticker=new Ticker(" POLITEKNIK NEGERI SRIWIJAYA ");
form.setTicker(ticker);
try {
img = Image.createImage("/graha.jpg");
img2 = new ImageItem("Jl. Srijaya Negara Bukit Besar 30139 Telpon:+620711353414 Fax:+62711355918 www.polsri.ac.id", img,ImageItem.LAYOUT_CENTER,"");
form.append(img2);
form.setCommandListener(this);


Start = new Command("Start", Command.OK,1);
exit = new Command("Exit", Command.OK,1);
form.addCommand(Start);
form.addCommand(exit);

} catch (IOException e){
System.out.println("error"+e);
}
}
public void startApp(){
display=Display.getDisplay(this);
display.setCurrent(form);
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional){
notifyDestroyed();
}
public void commandAction(Command c , Displayable dd){
if (c==exit)
destroyApp(true);
else if (c==Start)
display.setCurrent(form);
}
}

Lalu jalankan program dengan icon build pada J2ME dan kemudian run.
Hasil outputnya adalah sebagai berikut :


Membuat Tulisan Berjalan, Teks Alamat dan Menampilkan Gambar pada J2ME

 Ketikkan Program berikut pada textpad dan simpan dengan nama "SOMidlet".

import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class SOMidlet extends MIDlet implements CommandListener {
private Display display;
private Form form, login;
private Ticker ticker;
private Command Start, exit, back;
private Image img;
private ImageItem img2;
private TextField tf_Username;
private TextField tf_Password;
public SOMidlet(){
form = new Form("");
ticker=new Ticker(" POLITEKNIK NEGERI SRIWIJAYA ");
form.setTicker(ticker);
try {
img = Image.createImage("/graha.jpg");
img2 = new ImageItem("Jl. Srijaya Negara Bukit Besar 30139 Telpon:+620711353414 Fax:+62711355918 www.polsri.ac.id", img,ImageItem.LAYOUT_CENTER,"");
form.append(img2);
form.setCommandListener(this);


Start = new Command("Start", Command.OK,1);
exit = new Command("Exit", Command.OK,1);
form.addCommand(Start);
form.addCommand(exit);

} catch (IOException e){
System.out.println("error"+e);
}
}
public void startApp(){
display=Display.getDisplay(this);
display.setCurrent(form);
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional){
notifyDestroyed();
}
public void commandAction(Command c , Displayable dd){
if (c==exit)
destroyApp(true);
else if (c==Start)
display.setCurrent(form);
}
}

Lalu jalankan program dengan icon build pada J2ME dan kemudian run.
Hasil outputnya adalah sebagai berikut :


 
Free Website templateswww.seodesign.usFree Flash TemplatesRiad In FezFree joomla templatesAgence Web MarocMusic Videos OnlineFree Wordpress Themes Templatesfreethemes4all.comFree Blog TemplatesLast NewsFree CMS TemplatesFree CSS TemplatesSoccer Videos OnlineFree Wordpress ThemesFree Web Templates