int num = Integer.valueOf(jTextField编号.getText());
String name = jTextField姓名.getText();
String sex = jTextField性别.getText(); int age = Integer.valueOf(jTextField年龄.getText());我屏蔽掉第四语句,系统编译成功。保留第四句则报错了..
run:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:468)
at java.lang.Integer.parseInt(Integer.java:497)
at clinicpath1.secondframe.提交ActionPerformed(secondframe.java:292)
at clinicpath1.secondframe.access$000(secondframe.java:24)
at clinicpath1.secondframe$1.actionPerformed(secondframe.java:110)点击错误行,弹出一个新的类:Integer.java[r/o]
String name = jTextField姓名.getText();
String sex = jTextField性别.getText(); int age = Integer.valueOf(jTextField年龄.getText());我屏蔽掉第四语句,系统编译成功。保留第四句则报错了..
run:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:468)
at java.lang.Integer.parseInt(Integer.java:497)
at clinicpath1.secondframe.提交ActionPerformed(secondframe.java:292)
at clinicpath1.secondframe.access$000(secondframe.java:24)
at clinicpath1.secondframe$1.actionPerformed(secondframe.java:110)点击错误行,弹出一个新的类:Integer.java[r/o]
有时候空格也会影响包装,最好用jTextField年龄.getText().trim()处理一下