修改JAVA错误
下面两个事件为什么有NullPointerException异常?具体源程序在附件中,这是用JBUILDER2005开发的!
public void jButton1_actionPerformed(ActionEvent e) {
try{
int i=Integer.parseInt(item);
int m = xuan[i].size();
for(int k=1;k<=m;k++)
{
String row[]={String.valueOf(k),(String)nameda.elementAt(i),(String)xuan[i].elementAt(k)};
model.addRow(row);
}
}catch(NullPointerException ee){System.out.print(ee);}
}
public void jComboBox1_actionPerformed(ActionEvent e) {
try {
item = (String) jComboBox1.getSelectedItem();
int i = Integer.parseInt(item);
jTextArea1.setText((String) nameda.elementAt(i));
} catch (ArrayIndexOutOfBoundsException ee) {
System.out.print(ee);
}
}