public class FileChooserUtils
extends java.lang.Object
JFileChooser
related functions.Modifier and Type | Method and Description |
---|---|
static void |
sanitizeCurrentDirectory(@NotNull javax.swing.JFileChooser fileChooser)
Makes sure the current directory of a
JFileChooser is valid. |
static void |
setCurrentDirectory(@NotNull javax.swing.JFileChooser fileChooser,
@Nullable java.io.File dir)
Calls
JFileChooser.setCurrentDirectory(File) . |
public static void setCurrentDirectory(@NotNull @NotNull javax.swing.JFileChooser fileChooser, @Nullable @Nullable java.io.File dir)
JFileChooser.setCurrentDirectory(File)
. Makes sure the
passed directory exists to minimize the chance for NullPointerExceptions
. See Bugreport
4869950.fileChooser
- the file chooser to affectdir
- the directory to set; null
=user's home directorypublic static void sanitizeCurrentDirectory(@NotNull @NotNull javax.swing.JFileChooser fileChooser)
JFileChooser
is valid.fileChooser
- the file chooser to check