Menu Utama
Pilihan menu
Page 1 :
Pilihan Menu Page 1 :
Page 2 :
Pilihan Menu Page 2 :
Page 3 :
Pilihan Menu Page 3 :
Coding :
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author Lidia @ 11.04.2015
*/
public class Tugas1 extends MIDlet implements CommandListener{
Display dis;
Command exitCommand = new Command("Exit", Command.EXIT,1);
Command page1Command = new Command("Page 1", Command.OK,1);
Command page2Command = new Command("Page 2", Command.OK,1);
Command page3Command = new Command("Page 3", Command.OK,1);
Command homeCommand = new Command("Home", Command.OK,1);
Form homeForm = null;
Form page1Form = null;
Form page2Form = null;
Form page3Form = null;
public Tugas1(){
super();
homeForm=new Form("Selamat Datang Di Polmed");
homeForm.addCommand(exitCommand);
homeForm.addCommand(page1Command);
homeForm.addCommand(page2Command);
homeForm.addCommand(page3Command);
homeForm.setCommandListener(this);
page1Form=new Form("Page 1");
page1Form.addCommand(homeCommand);
page1Form.addCommand(page2Command);
page1Form.addCommand(page3Command);
page1Form.addCommand(exitCommand);
page1Form.setCommandListener(this);
page2Form=new Form("Page 2");
page2Form.addCommand(homeCommand);
page2Form.addCommand(page1Command);
page2Form.addCommand(page3Command);
page2Form.addCommand(exitCommand);
page2Form.setCommandListener(this);
page3Form=new Form("Page 3");
page3Form.addCommand(homeCommand);
page3Form.addCommand(page1Command);
page3Form.addCommand(page2Command);
page3Form.addCommand(exitCommand);
page3Form.setCommandListener(this);
}
public void startApp() {
if (dis==null){
dis=Display.getDisplay(this);
}
dis.setCurrent(homeForm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d){
if(c==exitCommand){
destroyApp(true);
notifyDestroyed(); //Exit
}
else if(c==page1Command){
dis.setCurrent(page1Form);
}
else if(c==page2Command){
dis.setCurrent(page2Form);
}
else if(c==page3Command){
dis.setCurrent(page3Form);
}
else if(c==homeCommand){
dis.setCurrent(homeForm);
}
}
Pilihan menu
Page 1 :
Pilihan Menu Page 1 :
Page 2 :
Pilihan Menu Page 2 :
Page 3 :
Pilihan Menu Page 3 :
Coding :
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author Lidia @ 11.04.2015
*/
public class Tugas1 extends MIDlet implements CommandListener{
Display dis;
Command exitCommand = new Command("Exit", Command.EXIT,1);
Command page1Command = new Command("Page 1", Command.OK,1);
Command page2Command = new Command("Page 2", Command.OK,1);
Command page3Command = new Command("Page 3", Command.OK,1);
Command homeCommand = new Command("Home", Command.OK,1);
Form homeForm = null;
Form page1Form = null;
Form page2Form = null;
Form page3Form = null;
public Tugas1(){
super();
homeForm=new Form("Selamat Datang Di Polmed");
homeForm.addCommand(exitCommand);
homeForm.addCommand(page1Command);
homeForm.addCommand(page2Command);
homeForm.addCommand(page3Command);
homeForm.setCommandListener(this);
page1Form=new Form("Page 1");
page1Form.addCommand(homeCommand);
page1Form.addCommand(page2Command);
page1Form.addCommand(page3Command);
page1Form.addCommand(exitCommand);
page1Form.setCommandListener(this);
page2Form=new Form("Page 2");
page2Form.addCommand(homeCommand);
page2Form.addCommand(page1Command);
page2Form.addCommand(page3Command);
page2Form.addCommand(exitCommand);
page2Form.setCommandListener(this);
page3Form=new Form("Page 3");
page3Form.addCommand(homeCommand);
page3Form.addCommand(page1Command);
page3Form.addCommand(page2Command);
page3Form.addCommand(exitCommand);
page3Form.setCommandListener(this);
}
public void startApp() {
if (dis==null){
dis=Display.getDisplay(this);
}
dis.setCurrent(homeForm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d){
if(c==exitCommand){
destroyApp(true);
notifyDestroyed(); //Exit
}
else if(c==page1Command){
dis.setCurrent(page1Form);
}
else if(c==page2Command){
dis.setCurrent(page2Form);
}
else if(c==page3Command){
dis.setCurrent(page3Form);
}
else if(c==homeCommand){
dis.setCurrent(homeForm);
}
}