I am a beginner to J2ME. The following is a small program I wrote just for test.
Theoretically, in my opinion, I shall see in the screen a number increase from 1 to 29999 rapidly after execute the code. But instead, it displays nothing but only displays 29999 after several seconds . Can some body point out what's wrong with this code? Thanks.
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Test extends MIDlet{
int x=1;
String b="";
private Display display;
public Test() {
display = Display.getDisplay(this);
}
public void startApp() {
MyCanvas mc = new MyCanvas() ;
display.setCurrent(mc) ;
while(x<30000){
b=String.valueOf(x);
mc.repaint();
x++;
}
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
class MyCanvas extends Canvas{
public void paint(Graphics g){
g.drawString(b,10,10,0);
}
}
}



