JFileChooser chooser = new JFileChooser( this.strSelectedPreAddr );
      chooser.setMultiSelectionEnabled(false);
      chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
      File file;
      String addr = "";
      if( chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION ) {
        file = chooser.getSelectedFile();

解决方案 »

  1.   

    JFileChooser c = new JFileChooser();
          // Demonstrate "Save" dialog:
          int rVal = 
            c.showSaveDialog(FileChooserTest.this);
          if(rVal == JFileChooser.APPROVE_OPTION) {
            filename.setText(
              c.getSelectedFile().getName());
          }
    注意,filename是你弹出对话筐的一个文本筐
    还有,请帮在下一个忙,你有个帖子有太多回复,我的机器打不开,内存太小,可否也给我发个实战ejb2.0,在下邮箱是  [email protected]  感激不禁