Materi Choice Group dalam java ME (NetBeans)


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pilihan;

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

/**
 * @author Lab A
 */
public class Pilih extends MIDlet implements CommandListener {
    private ChoiceGroup cg;
    private Form frm;
    private Command cKeluar, cPilih;

    public Pilih()
    {
        cg=new ChoiceGroup("Pilihan", Choice.EXCLUSIVE);
        frm=new Form("Kartu Seluler");
        cKeluar=new Command("Keluar", Command.EXIT, 1);
        cPilih=new Command("Pilih", Command.OK, 2);
    }

    public void startApp() {
        cg.append("Simpati", null);
        cg.append("IM3", null);
        cg.append("XL", null);
        cg.append("Mentari", null);
        frm.addCommand(cPilih);
        frm.addCommand(cKeluar);
        frm.setCommandListener(this);
        frm.append(cg);
        Display.getDisplay(this).setCurrent(frm);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void commandAction(Command c, Displayable d) {
        if (c==cKeluar)
        {
            metu();
        }
    }
    public void metu()
    {
        destroyApp(true);
        notifyDestroyed();
    }
}
◄ Posting Baru Posting Lama ►

------------------------Boost Your Website----------------------

 

Recomended


Free Chat


Copyright © . Art Media Blog - All Rights Reserved TOP