int r = chooser.showOpenDialog(null);
if (r == JFileChooser.APPROVE_OPTION)
{
   File f = chooser.getSelectedFile();
   try
   {
      ……//再就是文件的操作了!!!!!!
    }
     catch (IOException exception)
    {
    }
}