日期:2014-05-20  浏览次数:20739 次

关于J2ME的,只是简单的测试,可出问题了,求助,谢谢了
这是源码:jdk是1.6的,wtk是2.5R 





package sp_com_midlet;

import java.io.IOException;

import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.ImageItem;
import javax.microedition.lcdui.Item;
import javax.microedition.lcdui.ItemStateListener;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class HandleMidlet extends MIDlet implements CommandListener,ItemStateListener {
private Display display;
private Command cmdOk=new Command("Ok",Command.OK,1);
private Command cmdExit=new Command("Exit",Command.EXIT,1);
private Form form=new Form("姻缘生肖匹配查询");
private Image image;
private ChoiceGroup choicegender_m,choicegender_w,choiceshenxiao_m,choiceshenxiao_w;

public HandleMidlet() {
choicegender_m=new ChoiceGroup("请选择你的性别:",ChoiceGroup.POPUP);

choiceshenxiao_m=new ChoiceGroup("请选择你的生肖:",ChoiceGroup.MULTIPLE);

choicegender_w=new ChoiceGroup("请选择她(他)的性别:",ChoiceGroup.POPUP);
choiceshenxiao_w=new ChoiceGroup("请选择她(他)的生肖:",ChoiceGroup.MULTIPLE);
try {
image=Image.createImage("/con.png");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
choicegender_m.append("男", image);
choicegender_m.append("女", image);

choiceshenxiao_m.append("鼠", image);
choiceshenxiao_m.append("牛", image);
choiceshenxiao_m.append("虎", image);
choiceshenxiao_m.append("兔", image);
choiceshenxiao_m.append("龙", image);
choiceshenxiao_m.append("蛇", image);
choiceshenxiao_m.append("马", image);
choiceshenxiao_m.append("羊", image);
choiceshenxiao_m.append("猴", image);
choiceshenxiao_m.append("鸡", image);
choiceshenxiao_m.append("狗", image);
choiceshenxiao_m.append("猪", image);

choicegender_w.append("男", image);
choicegender_w.append("女", image);


choiceshenxiao_w.append("鼠", image);
choiceshenxiao_w.append("牛", image);
choiceshenxiao_w.append("虎", image);
choiceshenxiao_w.append("兔", image);
choiceshenxiao_w.append("龙", image);
choiceshenxiao_w.append("蛇", image);
choiceshenxiao_w.append("马", image);
choiceshenxiao_w.append("羊", image);
choiceshenxiao_w.append("猴", image);
choiceshenxiao_w.append("鸡", image);
choiceshenxiao_w.append("狗", image);
choiceshenxiao_w.append("猪", image);

form.append(choicegender_m);
form.append(choiceshenxiao_m);
form.append(choicegender_w);
form.append(choiceshenxiao_w);
form.addCommand(cmdOk);
form.addCommand(cmdExit);
form.setCommandListener(this);
display.setCurrent(form);
}

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub

}

protected void pauseApp() {
// TODO Auto-generated method stub

}

protected void startApp() throws MIDletStateChangeException {
display.getDisplay(this);

}

public void commandAction(Command c, Displayable d) {
if(c==cmdOk)