SizeChanged how to call this function the same as the crash

Category: J2ME
 
chengguangbo
2013-08-19 08:56:47

Sponsored Links
Do not know why? When calling this function the same as the crash did not respond to calls to the command of
did not respond. . . And no error occurs!
development tools: WTK2.1, ask! ! ! ! !

protected void sizeChanged (int w, int h) {
/ / execute the following two as the same crash! Halo, do not know why!
/ / System.out.println ("after changing the width of the" + w);
/ / System.out.println ("after changing the width of the" + h);

The following is the source code:
/ / canvastest.java
import javax.microedition.lcdui. *;
import javax.microedition.midlet. *;

public class canvastest extends MIDlet {
private Display display;
public canvastest () {
display = Display.getDisplay (this);
}
public void startApp () {
mycanvasx f = new mycanvasx ();
display.setCurrent (f);
}
public void pauseApp () {
}
public void destroyApp (boolean unconditional) {
}
}
class mycanvasx extends Canvas
implements CommandListener {
public mycanvasx () {
setTitle ("ddd");
setTicker (new Ticker ("dd"));
addCommand (new Command ("fullscreen", Command.SCREEN, 1));
addCommand (new Command ("Back", Command. SCREEN, 1));
this.setCommandListener (this);
}

public void clear (Graphics g) {
g.setColor (255,255,255);
g.fillRect (0,0, getWidth (), getHeight ());
}

public void paint (Graphics g) {
clear (g);
g.setColor (255,123,51);
g.drawLine (10,10,160,270);
}

public ; void commandAction (Command c, Displayable s) {
String cmd = c.getLabel ();
if (cmd.equals ("fullscreen")) {
setFullScreenMode (true);
}
else if (cmd.equals ("return")) {
setFullScreenMode (false);
}
}

protected void sizeChanged (int w, int h) {
/ / execute the following two as the same crash! Halo, do not know why!
/ / System.out.println ("after changing the width of the" + w);
/ / System.out.println ("after changing the width of the" + h);
}

protected void hideNotify () {
}

protected void showNotify () {
}
}

Sponsored Links

gwj35136418
2013-08-19 09:03:25
I tried your code, no problem! Shielded System.out.println ("after the change width of" + w);
System.out.println ("after changing the width of the" + h);
canceled , can also be displayed properly!
ghght
2013-08-19 09:08:01
My WTK have RPWT?
5555555555555
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.