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