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 :
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 :
Langganan:
Postingan (Atom)