Java JFileChooser getFile()

Here you can find the source of getFile()

Description

get File

License

Open Source License

Declaration

public static File getFile() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import javax.swing.JFileChooser;

public class Main {
    public static File getFile() {

        // create a file chooser
        JFileChooser fileChooser = new JFileChooser();
        // show open file dialog
        int result = fileChooser.showOpenDialog(null);
        if (result == JFileChooser.APPROVE_OPTION) {
            return fileChooser.getSelectedFile();
        }/*from   ww  w . j  a va  2  s  .co  m*/
        return null;
    }
}

Related

  1. fileChooser()
  2. getChoiceFileFromUser()
  3. getDir(String title, String initDir, boolean allowFiles, Component parent)
  4. getDriveDisplayName(File path)
  5. getExtension(File f)
  6. getFile(Component parent, String title, boolean write)
  7. getFile(FileFilter filter)
  8. getFile(String initialPath, final String extension, String TitleText)
  9. getFile(String message, boolean isLoadNotSave, File defaultFileOrDir, boolean allowMultipleSelection, String description, final String... extensions)