Listing Tugas Mobile Programing
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package newpackage;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.*;
/**
* @author Rieza
*/
public class Rieza extends MIDlet implements CommandListener {
private Display disp;
private Form form1, form2, form3;
private Command cadBack, cadNext, cadExit;
public Rieza(){
disp=Display.getDisplay(this);
form1=new Form("Form 1");
form2=new Form("Form 2");
form3=new Form("Form 3");
cadBack= new Command("<<<",Command.BACK,1);
cadNext= new Command(">>>",Command.ITEM,1);
cadExit= new Command("EXIT",Command.EXIT,1);
form1.addCommand(cadNext);
form1.addCommand(cadExit);
form1.setCommandListener(this);
form2.addCommand(cadBack);
form2.addCommand(cadNext);
form2.setCommandListener(this);
form3.addCommand(cadBack);
form3.addCommand(cadExit);
form3.setCommandListener(this);
}
public void startApp() {
disp.setCurrent(form1);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
notifyDestroyed();
}
public void commandAction(Command c, Displayable d) {
if(c==cadBack){
if(d==form2){
disp.setCurrent(form1);
}else if(d==form3){
disp.setCurrent(form2);
}
}else if(c==cadNext){
if(d==form1){
disp.setCurrent(form2);
}else if(d==form2){
disp.setCurrent(form3);
}
}else if(c==cadExit){
destroyApp(true);
}
}
}