summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc
diff options
context:
space:
mode:
Diffstat (limited to 'base/src/main/java/bjc')
-rw-r--r--base/src/main/java/bjc/utils/gui/awt/ExtensionFileFilter.java11
-rw-r--r--base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java75
-rw-r--r--base/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java7
-rw-r--r--base/src/main/java/bjc/utils/gui/layout/HLayout.java5
4 files changed, 56 insertions, 42 deletions
diff --git a/base/src/main/java/bjc/utils/gui/awt/ExtensionFileFilter.java b/base/src/main/java/bjc/utils/gui/awt/ExtensionFileFilter.java
index eb60ae2..5998345 100644
--- a/base/src/main/java/bjc/utils/gui/awt/ExtensionFileFilter.java
+++ b/base/src/main/java/bjc/utils/gui/awt/ExtensionFileFilter.java
@@ -13,19 +13,16 @@ import bjc.utils.funcdata.IList;
* Built for AWT
*
* @author ben
- *
*/
public class ExtensionFileFilter implements FilenameFilter {
- /**
- * The list of extensions to filter
- */
+ /* The list of extensions to filter */
private final IList<String> extensions;
/**
* Create a new filter only showing files with the specified extensions.
*
* @param exts
- * The extensions to show in this filter.
+ * The extensions to show in this filter.
*/
public ExtensionFileFilter(final List<String> exts) {
if (exts == null) throw new NullPointerException("Extensions must not be null");
@@ -37,7 +34,7 @@ public class ExtensionFileFilter implements FilenameFilter {
* Create a new filter only showing files with the specified extensions.
*
* @param exts
- * The extensions to show in this filter.
+ * The extensions to show in this filter.
*/
public ExtensionFileFilter(final String... exts) {
extensions = new FunctionalList<>(exts);
@@ -47,4 +44,4 @@ public class ExtensionFileFilter implements FilenameFilter {
public boolean accept(final File directory, final String name) {
return extensions.anyMatch(name::endsWith);
}
-} \ No newline at end of file
+}
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 77a4a59..e9236fe 100644
--- a/base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
+++ b/base/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java
@@ -8,42 +8,50 @@ import java.io.FilenameFilter;
import bjc.utils.gui.SimpleDialogs;
/**
- * A simple way to get the user to pick a file
+ * 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
+ * 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
- * @return The file the user picked
+ * The title of the file picker.
+ *
+ * @return
+ * The file the user picked.
*/
public static File getOpenFile(final Frame parent, final String title) {
return getOpenFile(parent, title, (String[]) null);
}
/**
- * Prompt the user to pick a file to open
+ * 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
- * @return The file the user picked
+ * 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)
+ 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);
@@ -63,20 +71,25 @@ public class SimpleFileDialog {
}
/**
- * Prompt the user to pick a file to open
+ * 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
- * @return The file the user picked
+ * 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)
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);
@@ -100,10 +113,13 @@ 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
- * @return The file the user picked
+ * The title of the file picker
+ *
+ * @return
+ * The file the user picked
*/
public static File getSaveFile(final Frame parent, final String title) {
return getSaveFile(parent, title, (String[]) null);
@@ -113,17 +129,22 @@ 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
- * @return The file the user picked
+ * 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)
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);
diff --git a/base/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java b/base/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java
index 6f384f2..0d835aa 100644
--- a/base/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java
+++ b/base/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java
@@ -7,15 +7,12 @@ import java.awt.GridLayout;
* resized.
*
* @author ben
- *
*/
public class AutosizeLayout extends GridLayout {
- // Version id for serialization
+ /* Version id for serialization. */
private static final long serialVersionUID = -2495693595953396924L;
- /**
- * Create a new auto-size layout.
- */
+ /** Create a new auto-size layout. */
public AutosizeLayout() {
super(1, 1);
}
diff --git a/base/src/main/java/bjc/utils/gui/layout/HLayout.java b/base/src/main/java/bjc/utils/gui/layout/HLayout.java
index 4ed1661..6e4f878 100644
--- a/base/src/main/java/bjc/utils/gui/layout/HLayout.java
+++ b/base/src/main/java/bjc/utils/gui/layout/HLayout.java
@@ -7,17 +7,16 @@ import java.awt.GridLayout;
* them.
*
* @author ben
- *
*/
public class HLayout extends GridLayout {
- // Version ID for serialization
+ /* Version ID for serialization. */
private static final long serialVersionUID = 1244964456966270026L;
/**
* Create a new horizontal layout with the specified number of columns.
*
* @param columns
- * The number of columns in this layout.
+ * The number of columns in this layout.
*/
public HLayout(final int columns) {
super(1, columns);