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
Gauge Voting

Enter subhead content here

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

public class GaVotMid extends MIDlet implements CommandListener{
private Display d;
private Form f;
private Command cexit,csubmit;
private Alert response;
private Gauge gaVot;
public  GaVotMid(){
d =  Display.getDisplay(this);
f = new Form("Voting /Rating Test By Gauge");
cexit = new Command("EXIT",Command.EXIT,1);
csubmit = new Command("SUBMIT",Command.ITEM,1);

gaVot = new Gauge("Gauge Progress",true,30,0);
f.append(gaVot);
f.append("Hello how are you");
f.addCommand(cexit);
f.addCommand(csubmit);
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 == cexit)
notifyDestroyed(); 
else if( c == csubmit){
int rate = gaVot.getValue();
response = new Alert("Response","Rating given by user is "+rate,null,AlertType.INFO);
response.setTimeout(Alert.FOREVER);
//System.out.println(" width"+gaVot.getPreferredWidth() +" Height "+gaVot.getPreferredHeight());
gaVot.setPreferredSize(gaVot.getPreferredWidth()*3,gaVot.getPreferredHeight());
d.setCurrent(response,f);
}
}

}//end of class GaVotMid


Enter supporting content here

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