Laman

Like

BAGI ANDA MERASA INI BERMANFAAT SILAHKAN LIKE PAGE ON FACEBOOK DIBAWAH INI!!!


Like Page halaman http://iswahyuniiswahyuni.blogspot.com/ di Facebook!!

Jumat, 18 Desember 2015

Mobile Programming Net Beans IDE 6.0 "List Menu"




Listing Program :


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

public class spidol extends MIDlet implements CommandListener {
    List list_menu;
    Command Keluar;
    Form Halaman_1;
    Display Layar;
   
    public spidol (){
        Keluar = new Command ("Exit", Command.EXIT,0);
        list_menu = new List ("Contoh List Menu", List.IMPLICIT);
        list_menu.append ("Hai1", null);
        list_menu.append ("Hai2", null);
        list_menu.append ("Hai3", null);
        list_menu.addCommand(Keluar);
        Halaman_1 = new Form ("Halaman Hai1");
        Halaman_1.append("Hai \n Hai \n Hai \n Hai");
        list_menu.setCommandListener(this);
    }
    public void startApp() {
        Layar=Display.getDisplay(this);
        Layar.setCurrent(list_menu);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void commandAction(Command C, Displayable D) {
        if (C==Keluar){
            destroyApp(true);
            notifyDestroyed();
        }
        if (C==List.SELECT_COMMAND){
            int i= list_menu.getSelectedIndex();
            String S = list_menu.getString(i);
            if(S=="Hai1"){
                Layar.setCurrent(Halaman_1);
            }
        }
    }
}

Tidak ada komentar:

Posting Komentar