summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-04-13 18:40:41 -0400
committerBen Culkin <scorpress@gmail.com>2020-04-13 18:40:41 -0400
commitd4ca769e542b2489b1e23cfcbdc3a0b7275b87cd (patch)
tree1653a7399f97fb0c63ce62e3f60fd830d5c37f70 /base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
parent2ac2e31a56ae59ee582e43a90c3495f86dd9ee7a (diff)
Cleanup pass
Cleanup pass to uniformize things
Diffstat (limited to 'base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java')
-rw-r--r--base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java70
1 files changed, 39 insertions, 31 deletions
diff --git a/base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java b/base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
index daea7cd..2cb3122 100644
--- a/base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
+++ b/base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
@@ -19,10 +19,10 @@ public class SimpleFileDialog {
* Prompt the user to pick a file to open.
*
* @param parent
- * The parent of the file picker.
+ * The parent of the file picker.
*
* @param title
- * The title of the file picker.
+ * The title of the file picker.
*
* @return The file the user picked.
*/
@@ -34,34 +34,36 @@ public class SimpleFileDialog {
* Prompt the user to pick a file to open.
*
* @param parent
- * The parent of the file picker.
+ * The parent of the file picker.
*
* @param title
- * The title of the file picker.
+ * The title of the file picker.
*
* @param extensions
- * The extensions to accept as valid.
+ * The extensions to accept as valid.
*
* @return The file the user picked.
*/
- public static File getOpenFile(final Frame parent, final String title, final String... extensions) {
- if(parent == null) {
+ public static File getOpenFile(final Frame parent, final String title,
+ final String... extensions) {
+ if (parent == null) {
throw new NullPointerException("Parent must not be null");
- } else if(title == null) {
+ } else if (title == null) {
throw new NullPointerException("Title must not be null");
}
final FileDialog chooser = new FileDialog(parent, title, FileDialog.LOAD);
- if(extensions != null) {
+ if (extensions != null) {
final FilenameFilter filter = new ExtensionFileFilter(extensions);
chooser.setFilenameFilter(filter);
}
chooser.setVisible(true);
- while(chooser.getFile() == null) {
- SimpleDialogs.showError(parent, "File I/O Error", "Please choose a file to open.");
+ while (chooser.getFile() == null) {
+ SimpleDialogs.showError(parent, "File I/O Error",
+ "Please choose a file to open.");
chooser.setVisible(true);
}
@@ -72,24 +74,26 @@ public class SimpleFileDialog {
* Prompt the user to pick a file to open.
*
* @param parent
- * The parent of the file picker.
+ * The parent of the file picker.
*
* @param title
- * The title of the file picker.
+ * The title of the file picker.
*
* @param extensions
- * The extensions to accept as valid.
+ * The extensions to accept as valid.
*
* @return The file the user picked.
*/
- public static File[] getOpenFiles(final Frame parent, final String title, final String... extensions) {
- if(parent == null)
+ public static File[] getOpenFiles(final Frame parent, final String title,
+ final String... extensions) {
+ if (parent == null)
throw new NullPointerException("Parent must not be null");
- else if(title == null) throw new NullPointerException("Title must not be null");
+ else if (title == null)
+ throw new NullPointerException("Title must not be null");
final FileDialog chooser = new FileDialog(parent, title, FileDialog.LOAD);
- if(extensions != null) {
+ if (extensions != null) {
final FilenameFilter filter = new ExtensionFileFilter(extensions);
chooser.setFilenameFilter(filter);
}
@@ -97,8 +101,9 @@ public class SimpleFileDialog {
chooser.setMultipleMode(true);
chooser.setVisible(true);
- while(chooser.getFile() == null) {
- SimpleDialogs.showError(parent, "File I/O Error", "Please choose a file to open.");
+ while (chooser.getFile() == null) {
+ SimpleDialogs.showError(parent, "File I/O Error",
+ "Please choose a file to open.");
chooser.setVisible(true);
}
@@ -109,10 +114,10 @@ public class SimpleFileDialog {
* Prompt the user to pick a file to save
*
* @param parent
- * The parent of the file picker
+ * The parent of the file picker
*
* @param title
- * The title of the file picker
+ * The title of the file picker
*
* @return The file the user picked
*/
@@ -124,32 +129,35 @@ public class SimpleFileDialog {
* Prompt the user to pick a file to save
*
* @param parent
- * The parent of the file picker
+ * The parent of the file picker
*
* @param title
- * The title of the file picker
+ * The title of the file picker
*
* @param extensions
- * The extensions to accept as valid
+ * The extensions to accept as valid
*
* @return The file the user picked
*/
- public static File getSaveFile(final Frame parent, final String title, final String... extensions) {
- if(parent == null)
+ public static File getSaveFile(final Frame parent, final String title,
+ final String... extensions) {
+ if (parent == null)
throw new NullPointerException("Parent must not be null");
- else if(title == null) throw new NullPointerException("Title must not be null");
+ else if (title == null)
+ throw new NullPointerException("Title must not be null");
final FileDialog chooser = new FileDialog(parent, title, FileDialog.SAVE);
- if(extensions != null) {
+ if (extensions != null) {
final FilenameFilter filter = new ExtensionFileFilter(extensions);
chooser.setFilenameFilter(filter);
}
chooser.setVisible(true);
- while(chooser.getFile() == null) {
- SimpleDialogs.showError(parent, "File I/O Error", "Please choose a file to save to.");
+ while (chooser.getFile() == null) {
+ SimpleDialogs.showError(parent, "File I/O Error",
+ "Please choose a file to save to.");
chooser.setVisible(true);
}