* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package triana.novi.midlet;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author Novi Triana
*/
public class HMidlet extends MIDlet
implements CommandListener {
Display disp;
private Command exitCommand = new Command("Exit", Command.EXIT, 1);
private Command page1 = new Command("Page 1", Command.SCREEN, 1);;
private Command page2 = new Command("Page 2", Command.SCREEN, 1);
private Command page3 = new Command("Page 3", Command.SCREEN, 1);
private Command home = new Command("Home", Command.SCREEN, 1);
public void startApp() {
Form formHome = new Form("Home");
formHome.append("Welcome to State Polytechnic of Medan Official Page");
formHome.addCommand(exitCommand);
formHome.addCommand(page1);
formHome.addCommand(page2);
formHome.addCommand(page3);
formHome.setCommandListener(this);
Display.getDisplay(this).setCurrent(formHome);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == exitCommand) {
destroyApp(true);
notifyDestroyed();
} else if (c == page1) {
Form formPage1 = new Form("Page 1");
formPage1.append("This is page 1");
formPage1.addCommand(home);
formPage1.addCommand(page2);
formPage1.addCommand(page3);
formPage1.addCommand(exitCommand);
formPage1.setCommandListener(this);
Display.getDisplay(this).setCurrent(formPage1);
} else if (c == page2) {
Form formPage2 = new Form("Page 2");
formPage2.append("This is page 2");
formPage2.addCommand(home);
formPage2.addCommand(page1);
formPage2.addCommand(page3);
formPage2.addCommand(exitCommand);
formPage2.setCommandListener(this);
Display.getDisplay(this).setCurrent(formPage2);
} else if (c == page3) {
Form formPage3 = new Form("Page 3");
formPage3.append("This is page 3");
formPage3.addCommand(home);
formPage3.addCommand(page1);
formPage3.addCommand(page2);
formPage3.addCommand(exitCommand);
formPage3.setCommandListener(this);
Display.getDisplay(this).setCurrent(formPage3);
} else if (c == home) {
startApp();
}
}
}
Tidak ada komentar:
Posting Komentar