diff options
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java b/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java index 1d14903..2e13949 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java @@ -7,7 +7,26 @@ import java.io.FilenameFilter; import bjc.utils.gui.SimpleDialogs; +/** + * A simple way to get the user to pick a file + * + * Built for AWT. + * + * @author ben + * + */ public class SimpleFileDialog { + /** + * Prompt the user to pick a file to open + * + * @param par + * The parent of the file picker + * @param title + * The title of the file picker + * @param extensions + * The extensions to accept as valid + * @return The file the user picked + */ public static File getOpenFile(Frame par, String title, String... extensions) { FileDialog fd = new FileDialog(par, title, FileDialog.LOAD); @@ -28,10 +47,30 @@ public class SimpleFileDialog { return fd.getFiles()[0]; } + /** + * Prompt the user to pick a file to open + * + * @param par + * The parent of the file picker + * @param title + * The title of the file picker + * @return The file the user picked + */ public static File getOpenFile(Frame par, String title) { return getOpenFile(par, title, (String[]) null); } - + + /** + * Prompt the user to pick a file to save + * + * @param par + * The parent of the file picker + * @param title + * The title of the file picker + * @param extensions + * The extensions to accept as valid + * @return The file the user picked + */ public static File getSaveFile(Frame par, String title, String... extensions) { FileDialog fd = new FileDialog(par, title, FileDialog.SAVE); @@ -52,6 +91,15 @@ public class SimpleFileDialog { return fd.getFiles()[0]; } + /** + * Prompt the user to pick a file to save + * + * @param par + * The parent of the file picker + * @param title + * The title of the file picker + * @return The file the user picked + */ public static File getSaveFile(Frame par, String title) { return getSaveFile(par, title, (String[]) null); } |
