org.apache.jmeter.gui.util

## Class FileDialoger

- java.lang.Object
- - org.apache.jmeter.gui.util.FileDialoger

-     public final class FileDialoger
      extends Object

  Class implementing a file open dialogue

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getLastJFCDirectory()`
    `static JFileChooser` | `promptToOpenFile()` Prompts the user to choose a file or a directory from their filesystems for our own devious uses.
    `static JFileChooser` | `promptToOpenFile(Component parentComponent, String[] exts, String existingFileName, boolean onlyDirectories)` Prompts the user to choose a file or a directory from their filesystems for our own devious uses.
    `static JFileChooser` | `promptToOpenFile(String existingFileName)` Prompts the user to choose a file or a directory from their filesystems for our own devious uses.
    `static JFileChooser` | `promptToOpenFile(String[] exts)` Prompts the user to choose a file or a directory from their filesystems for our own devious uses.
    `static JFileChooser` | `promptToOpenFile(String[] exts, String existingFileName)` Prompts the user to choose a file or a directory from their filesystems for our own devious uses.
    `static JFileChooser` | `promptToOpenFile(String[] exts, String existingFileName, boolean onlyDirectories)` Prompts the user to choose a file or a directory from their filesystems for our own devious uses.
    `static JFileChooser` | `promptToOpenFile(String existingFileName, boolean onlyDirectories)` Prompts the user to choose a file or a directory from their filesystems for our own devious uses.
    `static JFileChooser` | `promptToSaveFile(String filename)` Prompts the user to choose a file from their filesystems for our own devious uses.
    `static JFileChooser` | `promptToSaveFile(String filename, String[] extensions)` Get a JFileChooser with a new FileFilter.
    `static void` | `setLastJFCDirectory(String lastJFCDirectory)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### promptToOpenFile

          public static JFileChooser promptToOpenFile()

      Prompts the user to choose a file or a directory from their filesystems for our own devious uses. This method maintains the last directory the user visited before dismissing the dialog. This does NOT imply they actually chose a file from that directory, only that they closed the dialog there. It is the caller's responsibility to check to see if the selected file is non-null.
      Returns:
        the JFileChooser that interacted with the user, after they are finished using it - null if no file was chosen

    - #### promptToOpenFile

          public static JFileChooser promptToOpenFile(String existingFileName)

      Prompts the user to choose a file or a directory from their filesystems for our own devious uses. This method maintains the last directory the user visited before dismissing the dialog. This does NOT imply they actually chose a file from that directory, only that they closed the dialog there. It is the caller's responsibility to check to see if the selected file is non-null.
      Parameters:
        `existingFileName` - The name of a file with path. If the filename points to an existing file, the directory in which it lies, will be used as the starting point for the returned JFileChooser.
      Returns:
        the JFileChooser that interacted with the user, after they are finished using it - null if no file was chosen

    - #### promptToOpenFile

          public static JFileChooser promptToOpenFile(String existingFileName,
                                                      boolean onlyDirectories)

      Prompts the user to choose a file or a directory from their filesystems for our own devious uses. This method maintains the last directory the user visited before dismissing the dialog. This does NOT imply they actually chose a file from that directory, only that they closed the dialog there. It is the caller's responsibility to check to see if the selected file is non-null.
      Parameters:
        `existingFileName` - The name of a file with path. If the filename points to an existing file, the directory in which it lies, will be used as the starting point for the returned JFileChooser.
        `onlyDirectories` - If true, only directories are displayed in the FileChooser
      Returns:
        the JFileChooser that interacted with the user, after they are finished using it - null if no file was chosen

    - #### promptToOpenFile

          public static JFileChooser promptToOpenFile(String[] exts)

      Prompts the user to choose a file or a directory from their filesystems for our own devious uses. This method maintains the last directory the user visited before dismissing the dialog. This does NOT imply they actually chose a file from that directory, only that they closed the dialog there. It is the caller's responsibility to check to see if the selected file is non-null.
      Parameters:
        `exts` - The list of allowed file extensions. If empty, any file extension is allowed
      Returns:
        the JFileChooser that interacted with the user, after they are finished using it - null if no file was chosen

    - #### promptToOpenFile

          public static JFileChooser promptToOpenFile(String[] exts,
                                                      String existingFileName)

      Prompts the user to choose a file or a directory from their filesystems for our own devious uses. This method maintains the last directory the user visited before dismissing the dialog. This does NOT imply they actually chose a file from that directory, only that they closed the dialog there. It is the caller's responsibility to check to see if the selected file is non-null.
      Parameters:
        `exts` - The list of allowed file extensions. If empty, any file extension is allowed
        `existingFileName` - The name of a file with path. If the filename points to an existing file, the directory in which it lies, will be used as the starting point for the returned JFileChooser.
      Returns:
        the JFileChooser that interacted with the user, after they are finished using it - null if no file was chosen

    - #### promptToOpenFile

          public static JFileChooser promptToOpenFile(String[] exts,
                                                      String existingFileName,
                                                      boolean onlyDirectories)

      Prompts the user to choose a file or a directory from their filesystems for our own devious uses. This method maintains the last directory the user visited before dismissing the dialog. This does NOT imply they actually chose a file from that directory, only that they closed the dialog there. It is the caller's responsibility to check to see if the selected file is non-null.
      Parameters:
        `exts` - The list of allowed file extensions. If empty, any file extension is allowed
        `existingFileName` - The name of a file with path. If the filename points to an existing file, the directory in which it lies, will be used as the starting point for the returned JFileChooser.
        `onlyDirectories` - If true, only directories are displayed in the FileChooser
      Returns:
        the JFileChooser that interacted with the user, after they are finished using it - null if no file was chosen

    - #### promptToOpenFile

          public static JFileChooser promptToOpenFile(Component parentComponent,
                                                      String[] exts,
                                                      String existingFileName,
                                                      boolean onlyDirectories)

      Prompts the user to choose a file or a directory from their filesystems for our own devious uses. This method maintains the last directory the user visited before dismissing the dialog. This does NOT imply they actually chose a file from that directory, only that they closed the dialog there. It is the caller's responsibility to check to see if the selected file is non-null.
      Parameters:
        `parentComponent` - Component parent of current element
        `exts` - The list of allowed file extensions. If empty, any file extension is allowed
        `existingFileName` - The name of a file with path. If the filename points to an existing file, the directory in which it lies, will be used as the starting point for the returned JFileChooser.
        `onlyDirectories` - If true, only directories are displayed in the FileChooser
      Returns:
        the JFileChooser that interacted with the user, after they are finished using it - null if no file was chosen

    - #### promptToSaveFile

          public static JFileChooser promptToSaveFile(String filename)

      Prompts the user to choose a file from their filesystems for our own devious uses. This method maintains the last directory the user visited before dismissing the dialog. This does NOT imply they actually chose a file from that directory, only that they closed the dialog there. It is the caller's responsibility to check to see if the selected file is non-null.
      Parameters:
        `filename` - The name of a file with path. If the filename points to an existing file, the directory in which it lies, will be used as the starting point for the returned JFileChooser.
      Returns:
        the JFileChooser that interacted with the user, after they are finished using it - null if no file was chosen
      See Also:
        `promptToOpenFile()`

    - #### promptToSaveFile

          public static JFileChooser promptToSaveFile(String filename,
                                                      String[] extensions)

      Get a JFileChooser with a new FileFilter.
      Parameters:
        `filename` - file name
        `extensions` - list of extensions
      Returns:
        the FileChooser - null if no file was chosen

    - #### getLastJFCDirectory

          public static String getLastJFCDirectory()

      Returns:
        The last directory visited by the user while choosing Files

    - #### setLastJFCDirectory

          public static void setLastJFCDirectory(String lastJFCDirectory)

      Parameters:
        `lastJFCDirectory` - The last directory visited by the user while choosing Files

Copyright © 1998-2022 Apache Software Foundation. All Rights Reserved.