Jumat, 03 April 2015

Tugas Simulasi Web Browser J2ME

Sabtu,4 April 2015

package kiki;

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

public class Midlet
        extends MIDlet
        implements CommandListener {

    Display disp;
    private Command exitCommand;
    private Command TeknikKomputer;
    private Command TeknikMesin;
    private Command TeknikElektro;
    private Command home;
    public void startApp() {
        Form formHome = new Form("Home");
        formHome.append ("Selamat Datang Di Politeknik Negeri Medan");
        exitCommand = new Command ("Exit", Command.EXIT, 1);
        TeknikKomputer = new Command ("Teknik Komputer", Command.SCREEN, 1);
        TeknikMesin = new Command ("Teknik Mesin", Command.SCREEN, 1);
        TeknikElektro = new Command ("Teknik Elektro", Command.SCREEN, 1);
        formHome.addCommand(exitCommand);
        formHome.addCommand(TeknikKomputer);
        formHome.addCommand(TeknikMesin);
        formHome.addCommand(TeknikElektro);
        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 == TeknikKomputer) {
           
            Form formPage1 = new Form("Computer Engineering");
        formPage1.append ("This is Page Computer Engineering Polmed");
        exitCommand = new Command ("Exit", Command.EXIT, 1);
        TeknikMesin = new Command ("Teknik Mesin", Command.SCREEN, 1);
        TeknikElektro= new Command ("Teknik Elektro", Command.SCREEN, 1);
        home = new Command ("Home", Command.SCREEN,1);
        formPage1.addCommand(exitCommand);
        formPage1.addCommand(TeknikMesin);
        formPage1.addCommand(TeknikElektro);
        formPage1.addCommand(home);
        formPage1.setCommandListener(this);
        Display.getDisplay(this).setCurrent(formPage1);
        }
        else if (c == TeknikMesin) {
           
            Form formPage2 = new Form("Mechanical Engineering");
        formPage2.append ("This is Page Mechanical Engineering Polmed");
        exitCommand = new Command ("Exit", Command.EXIT, 1);
        TeknikKomputer = new Command ("Teknik Komputer", Command.SCREEN, 1);
        TeknikElektro = new Command ("Teknik Elektro", Command.SCREEN, 1);
        home = new Command ("Home", Command.SCREEN, 1);
        formPage2.addCommand(exitCommand);
        formPage2.addCommand(TeknikKomputer);
        formPage2.addCommand(TeknikElektro);
        formPage2.addCommand(home);
        formPage2.setCommandListener(this);
        Display.getDisplay(this).setCurrent(formPage2);
        }
        else if (c == TeknikElektro){
           
            Form formPage3 = new Form("Electrical Engineering ");
        formPage3.append ("This is Page Electrical Engineering Polmed");
        exitCommand = new Command ("Exit", Command.EXIT, 1);
        TeknikKomputer = new Command ("Teknik Komputer", Command.SCREEN, 1);
        TeknikMesin = new Command ("Teknik Mesin", Command.SCREEN, 1);
        home = new Command ("Home", Command.SCREEN, 1);
        formPage3.addCommand(exitCommand);
        formPage3.addCommand(TeknikKomputer);
        formPage3.addCommand(TeknikMesin);
        formPage3.addCommand(home);
        formPage3.setCommandListener(this);
        Display.getDisplay(this).setCurrent(formPage3);
        }
        else if (c == home){
            Form formHome = new Form("Home");
        formHome.append ("Selamat Datang Di Polmed");
        exitCommand = new Command ("Exit", Command.EXIT, 1);
        TeknikKomputer = new Command ("Teknik Komputer", Command.SCREEN, 1);
        TeknikMesin = new Command ("Teknik Mesin", Command.SCREEN, 1);
        TeknikElektro = new Command ("Teknik Elektro", Command.SCREEN, 1);
        formHome.addCommand(exitCommand);
        formHome.addCommand(TeknikKomputer);
        formHome.addCommand(TeknikMesin);
        formHome.addCommand(TeknikElektro);
        formHome.setCommandListener(this);
        Display.getDisplay(this).setCurrent(formHome);
    }
        }
        }

Hasil Scrent Shot:













Tidak ada komentar:

Posting Komentar