Home | J2ME Yours page | Favorite Links | Contact Me | objques | Canvas Demo | Fruit selection | Commands | Gauge NI | Gauge Response | Pallet | Pal Ex Mid | Slides Text
Prasad's J2ME programs
Check Box

Enter subhead content here

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

public class CheckMid extends MIDlet implements CommandListener{
private Display d;
private Form f;
private Command ce,cl;
private TextField phTe;
private ChoiceGroup chfrls;
private Date   d1;
private String[] choiStr;
private Gauge gaVol;
private DateField df;
public  CheckMid(){
d =  Display.getDisplay(this);
f = new Form("Test");
df = new DateField("Day",DateField.DATE);
choiStr = new String[]{"Apple","Banana","Orange","Sapota","Papaya","Strawberry"};
phTe = new TextField("Fruit list","",100,TextField.ANY|TextField.UNEDITABLE);
ce = new Command("EXIT",Command.EXIT,1);
cl = new Command("LIST",Command.ITEM,1);
chfrls = new ChoiceGroup("Fruits",Choice.MULTIPLE,choiStr,null);
gaVol = new Gauge("GaugeTest",true,20,1);
//d1 = new Date();
df.setDate(new java.util.Date());

f.append(gaVol);
f.append(df);

f.append("Helllo how are you");
f.append(chfrls);
f.append(phTe);

f.addCommand(ce);
f.addCommand(cl);
f.setCommandListener(this);
}
public void startApp(){
d.setCurrent(f);
}

public void pauseApp(){}
public void destroyApp(boolean unconditional){}

public void commandAction(Command c,Displayable s){
if( c == ce)
notifyDestroyed(); 
else if( c == cl){
String frlist = "";
boolean[] frfl = new boolean[chfrls.size()];
chfrls.getSelectedFlags(frfl);
for(int i = 0; i < chfrls.size() ;i++)
 if(frfl[i])
frlist = frlist + " "+chfrls.getString(i); 
phTe.setString(frlist);
}
}

}


Enter supporting content here

"Striving for success without hard work is like trying to harvest where you haven't planted."