手机程序(J2ME)
编写一个简单的MIDlet应用,实现接受用户输入的人员名字、性别、电话号码、E-mail地址等信息...
编写一个简单的MIDlet应用,实现接受用户输入的人员名字、性别、电话号码、E-mail地址等信息
展开
1个回答
展开全部
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class Midlet extends MIDlet {
TextField t_name, t_sex, t_tel, t_email;
Form form;
Display d;
public Midlet() {
d = Display.getDisplay(this);
t_name = new TextField("name:", "", 20, TextField.ANY);
t_sex = new TextField("sex:", "", 20, TextField.ANY);
t_tel = new TextField("TEL:", "", 20, TextField.NUMERIC);
t_email = new TextField("Email:", "", 20, TextField.ANY);
form = new Form("通讯录");
form.append(t_name);
form.append(t_sex);
form.append(t_tel);
form.append(t_email);
}
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 {
d.setCurrent(form);
}
}
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class Midlet extends MIDlet {
TextField t_name, t_sex, t_tel, t_email;
Form form;
Display d;
public Midlet() {
d = Display.getDisplay(this);
t_name = new TextField("name:", "", 20, TextField.ANY);
t_sex = new TextField("sex:", "", 20, TextField.ANY);
t_tel = new TextField("TEL:", "", 20, TextField.NUMERIC);
t_email = new TextField("Email:", "", 20, TextField.ANY);
form = new Form("通讯录");
form.append(t_name);
form.append(t_sex);
form.append(t_tel);
form.append(t_email);
}
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 {
d.setCurrent(form);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询