熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

Java對話框獲取目錄、文件路徑

2022-06-13   來源: Java核心技術 

  public File getFile(){

  final JFileChooser fc = new JFileChooser();

  fcsetFileSelectionMode(JFileChooserFILES_AND_DIRECTORIES);

  //        JFileChooserFILES_ONLY

  //        JFileChooserDIRECTORIES_ONLY

  int returnVal = fcshowOpenDialog(this);

  File file_choosed = fcgetSelectedFile();

  return file_choosed;

  }


From:http://tw.wingwit.com/Article/program/Java/hx/201311/27130.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.