Tugas2 – Wenda Aringga


import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class TugasKu2 extends MIDlet implements CommandListener{
Display display;
Command exitCommand;
Command backCommand;
Command okCommand;

Form imageForm;
List itemTugasKu2;
Ticker ticker;

public TugasKu2(){
display = Display.getDisplay(this);
exitCommand = new Command(“Exit”,Command.EXIT,1);
backCommand = new Command(“Back”,Command.BACK,2);
okCommand = new Command(“Ok”,Command.OK,3);

ticker = new Ticker(“Silahkan pilih foto yang anda sukai….”);
itemTugasKu2 = new List(null, Choice.IMPLICIT);
itemTugasKu2.append(“FotoKu”,null);
itemTugasKu2.append(“FotoJEDI”,null);
itemTugasKu2.append(“ApaMbuh”,null);

itemTugasKu2.setCommandListener(this);
itemTugasKu2.addCommand(exitCommand);
itemTugasKu2.setTicker(ticker);
display.setCurrent(itemTugasKu2);
}

public void startApp (){
}

public void destroyApp(boolean unconditional){
}

public void pauseApp(){
}

public void commandAction(Command c, Displayable d){

if(c==backCommand){
display.setCurrent(itemTugasKu2);
}else if(d==itemTugasKu2){
if(c==List.SELECT_COMMAND){
int i = itemTugasKu2.getSelectedIndex();
switch(i){
case 0:
imageForm = new Form(“FotoKu”);
imageForm.addCommand(backCommand);
imageForm.setCommandListener(this);

try {
Image img = Image.createImage(“/FotoKu.jpg”);
ImageItem image =    new ImageItem(“FotoKu”, img, Item.LAYOUT_CENTER, “Foto”);
imageForm.append(image);
} catch (Exception e){e.printStackTrace();}display.setCurrent(imageForm);
break;
case 1:
imageForm = new Form(“FotoJEDI”);
imageForm.addCommand(backCommand);
imageForm.setCommandListener(this);

try {
Image img = Image.createImage(“/FotoJEDI.jpg”);
ImageItem image =    new ImageItem(“FotoJEDI”, img, Item.LAYOUT_CENTER, “Foto”);
imageForm.append(image);
} catch (Exception e){e.printStackTrace();}display.setCurrent(imageForm);
break;

case 2:
imageForm = new Form(“ApaMbuh”);
imageForm.addCommand(backCommand);
imageForm.setCommandListener(this);
try {
Image img = Image.createImage(“/ApaMbuh.jpg”);
ImageItem image =    new ImageItem(“Apa Mbuh”, img, Item.LAYOUT_CENTER, “Foto”);
imageForm.append(image);
} catch (Exception e){e.printStackTrace();}display.setCurrent(imageForm);
break;
}
}else if(c==exitCommand){
notifyDestroyed();
}
}
}
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s