我是java的新手,我试图在按下按钮时它会更新放入表中的新信息。我收到此错误:在actionlistener中未报告的异常java.io.IOException
unreported exception java.io.IOException; must be caught or declared to be thrown
在这里,我有麻烦的代码:
public static void updateAction(){
update.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
BufferedWriter bfw = new BufferedWriter(new FileWriter(tmp));
for(int i = 0 ; i < table.getColumnCount() ; i++)
{
bfw.write(table.getColumnName(i));
bfw.write("\t");
}
for (int i = 0 ; i < table.getRowCount(); i++)
{
bfw.newLine();
for(int j = 0 ; j < table.getColumnCount();j++)
{
bfw.write((String)(table.getValueAt(i,j)));
bfw.write("\t");;
}
}
bfw.close();
}});
}
感谢任何帮助,您可以给我。