summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2016-02-21 15:42:14 -0500
committerbculkin2442 <bjculkin@mix.wvu.edu>2016-02-21 15:42:14 -0500
commitc2089e5a3e604424c7cd00bbddcb03731ff5a0ea (patch)
tree31854f794e47b8dc67ea10d6699368810ca78f55 /BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
parenteb30c23bb03579bf839189ab0d2ad172d5b07766 (diff)
Added new control and some commenting
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.java50
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);
}