J2ME 一个小程序的错误 30
importjavax.microedition.lcdui.Command;importjavax.microedition.lcdui.CommandListener...
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
public class exit extends MIDlet implements CommandListener {
private Display display;
private Command c;
private TextBox t;
public exit() {
display=Display.getDisplay(this);
t=new TextBox("asdfsd","sdfsf",0,0);
c=new Command("退出",Command.EXIT,1);
t.addCommand(c);
t.setCommandListener(this);
}
public void destroyApp(boolean arg0) {
}
public void pauseApp() {
}
public void startApp() {
display.setCurrent(t);
}
public void commandAction(Command arg0, Displayable arg1) {
if(arg0==c){
destroyApp(false);
notifyDestroyed();
}
}
} 展开
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
public class exit extends MIDlet implements CommandListener {
private Display display;
private Command c;
private TextBox t;
public exit() {
display=Display.getDisplay(this);
t=new TextBox("asdfsd","sdfsf",0,0);
c=new Command("退出",Command.EXIT,1);
t.addCommand(c);
t.setCommandListener(this);
}
public void destroyApp(boolean arg0) {
}
public void pauseApp() {
}
public void startApp() {
display.setCurrent(t);
}
public void commandAction(Command arg0, Displayable arg1) {
if(arg0==c){
destroyApp(false);
notifyDestroyed();
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询