Monday, 16 January 2012



J2ME program for Checkbox

import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class CheckExp extends MIDlet implements CommandListener
{
Form form;
Command exit,save;
ChoiceGroup check;
public void startApp()
{
          Display display = Display.getDisplay(this);
          form = new Form("Check Box Example");
          try
          {        check  = new ChoiceGroup("Subjects : ",Choice.MULTIPLE);
                   check.append("IP",null);
                   check.append("ADBMS",null);
                   check.append("COM",null);
          }
          catch(Exception e) 
{e.printStackTrace();}
          form.append(check);
          exit = new Command("Exit", Command.EXIT, 1);
          save = new Command("Save", Command.OK, 1);
          form.addCommand(save);
          form.addCommand(exit);
          form.setCommandListener(this);
          display.setCurrent(form);
}
  public void pauseApp ()  {}
  public void destroyApp(boolean unconditional)   {} 
  public void commandAction(Command c, Displayable s)
  {
if (c == exit)
          {
                   notifyDestroyed();
}
   }
}

Output:-

Related Posts :



0 comments:

Confused? Feel free to ask

Post a Comment