数据插入到数据库中时出现空指针异常,请问是传值异常还是哪个对象没有实例化?

publicvoidactionPerformed(ActionEvente){DBConnectioncon=newDBConnection();Stringno=No... public void actionPerformed(ActionEvent e) {
DBConnection con=new DBConnection();
String no=No_jf.getText();//报错的地方,67行
String kindname=Kindname_jf.getText();
String kind=Kind_cob.getSelectedItem().toString();
String month=Month_cob.getSelectedItem().toString();
String department=Department_jf.getText();
String sponsor=Sponsor_jf.getText();
String traintcompany=TraintCompany_jf.getText();
String teacher=teacher_jf.getText();
String teacheringmethods=Teachingmethods_cob.getSelectedItem().toString();
String classhours=ClassHours_jf.getText();
String pay=Pay_jf.getText();
String classstartdate=ClassStartDate_jf.getText();
String classoverdate=ClassOverDate_jf.getText();
String place=Place_jf.getText();
String content=Content_jf.getText();
String examkind=ExamKind_jf.getText();
String books=Books_jf.getText();
String remarks=Remarks_jf.getText();

Traint traint=new Traint();
traint.setNo(no);
traint.setKindname(kindname);
traint.setKind(kind);
traint.setMonth(month);
traint.setDepartment(department);
traint.setSponsor(sponsor);
traint.setTraincompany(traintcompany);
traint.setTeacher(teacher);
traint.setTeachmethods(teacheringmethods);
traint.setClasshours(classhours);
traint.setPay(pay);
traint.setStartdate(classstartdate);
traint.setOverdate(classoverdate);
traint.setPlace(place);
traint.setContent(content);
traint.setExamkind(examkind);
traint.setBooks(books);
traint.setRemarks(remarks);
con.insertintoTraint(traint);
}

});
报错:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.mwq.frame.TrainManagement$1.actionPerformed(TrainManagement.java:67)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
展开
 我来答
HollyElec
2011-12-20 · TA获得超过393个赞
知道小有建树答主
回答量:161
采纳率:0%
帮助的人:88.6万
展开全部
这是某个实例为null时,并且执行了操作所引起的,很有可能是你的实例化出现了问题。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式