实验报告
实验项目名称JAVA调试环境及异常处理程序所属课程名称面向对象技术实验类型设计型实验日期2014.4.1
班级信计12-2学号姓名马成绩
附录1:源程序
XXX.;XXX.;
XXX.event.;
publicclassWEe_tendsAppletimplementsActionListener{
Labelpr1,pr2;Te_tFieldt1,t2;Buttonb;Students;Stringmsg;
publicvoidinit(){
pr1=newLabel("姓名:");pr2=newLabel("学号:");t1=newTe_tField(7);t2=newTe_tField(7);b=newButton("OK");
XXX(this);add(pr1);add(t1);add(pr2);add(t2);
add(b);
s=newStudent();
msg="";
publicvoidactionPerformed(ActionEvente){
XXX(XXX(XXX()));msg=XXX();
catch(NumberFormatE_ceptionee)
msg="学号必须是数字!";
catch(NegativeE_ceptionee)
msg="学号必须是正整数!";
XXX.getTe_t();
repaint();
publicvoidpaint(Graphicsg)
XXX(msg,120,120);
classStudent
Stringname;
intid;
intage;
voidsetId(int_)throwsNegativeE_ception{
if(_>0)
id=_;
else
thrownewNegativeE_ception();
publicStringtoString()
return"姓名:"+name+"学号:"+id;}
classNegativeE_ceptione_tendsE_ception{