summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/gui
diff options
context:
space:
mode:
authorEVE <EVE@EVE-PC>2017-03-13 16:42:21 -0400
committerEVE <EVE@EVE-PC>2017-03-13 16:42:21 -0400
commit27bf571d6413c3cc6a5d664b5bddd38d21d7b1cd (patch)
tree847fb52acb091c1c613d37b8477094d5762c6988 /BJC-Utils2/src/main/java/bjc/utils/gui
parentaa807a96cae2c47259fb38f710640883060339e9 (diff)
Formatting
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/gui')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/ExtensionFileFilter.java10
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java116
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/SimpleFileChooser.java58
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java105
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalFrame.java2
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/SimpleJList.java8
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/SimpleTitledBorder.java2
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/TextAreaOutputStream.java2
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/awt/ExtensionFileFilter.java10
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java53
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java4
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/layout/HLayout.java6
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/layout/VLayout.java6
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java14
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/panels/FormattedInputPanel.java20
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/panels/HolderOutputPanel.java19
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/panels/ListParameterPanel.java29
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java12
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java24
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java12
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/panels/SliderInputPanel.java65
21 files changed, 259 insertions, 318 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/ExtensionFileFilter.java b/BJC-Utils2/src/main/java/bjc/utils/gui/ExtensionFileFilter.java
index bb147df..6a5e676 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/ExtensionFileFilter.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/ExtensionFileFilter.java
@@ -23,22 +23,20 @@ public class ExtensionFileFilter extends FileFilter {
private IList<String> extensions;
/**
- * Create a new filter only showing files with the specified
- * 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(List<String> exts) {
extensions = new FunctionalList<>(exts);
}
/**
- * Create a new filter only showing files with the specified
- * 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(String... exts) {
extensions = new FunctionalList<>(exts);
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java
index 68c4962..7e3cdfd 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java
@@ -25,26 +25,26 @@ public class SimpleDialogs {
* Get a bounded integer from the user.
*
* @param parent
- * The parent component for the dialogs.
+ * The parent component for the dialogs.
* @param title
- * The title for the dialogs.
+ * The title for the dialogs.
* @param prompt
- * The prompt to tell the user what to enter.
+ * The prompt to tell the user what to enter.
* @param lowerBound
- * The lower integer bound to accept.
+ * The lower integer bound to accept.
* @param upperBound
- * The upper integer bound to accept.
+ * The upper integer bound to accept.
* @return A int within the specified bounds.
*/
- public static int getBoundedInt(Component parent, String title,
- String prompt, int lowerBound, int upperBound) {
+ public static int getBoundedInt(Component parent, String title, String prompt, int lowerBound, int upperBound) {
return getValue(parent, title, prompt, (strang) -> {
try {
int value = Integer.parseInt(strang);
return (value < upperBound) && (value > lowerBound);
} catch (NumberFormatException nfex) {
- // We don't care about the specifics of the exception, just
+ // We don't care about the specifics of the
+ // exception, just
// that this value isn't good
return false;
}
@@ -55,21 +55,20 @@ public class SimpleDialogs {
* Asks the user to pick an option from a series of choices.
*
* @param <E>
- * The type of choices for the user to pick
+ * The type of choices for the user to pick
*
* @param parent
- * The parent frame for this dialog
+ * The parent frame for this dialog
* @param title
- * The title of this dialog
+ * The title of this dialog
* @param question
- * The question being asked
+ * The question being asked
* @param choices
- * The available choices for the question
+ * The available choices for the question
* @return The choice the user picked, or null if they didn't pick one
*/
@SuppressWarnings("unchecked")
- public static <E> E getChoice(Frame parent, String title,
- String question, E... choices) {
+ public static <E> E getChoice(Frame parent, String title, String question, E... choices) {
if (parent == null) {
throw new NullPointerException("Parent must not be null");
} else if (title == null) {
@@ -113,21 +112,21 @@ public class SimpleDialogs {
* Get a integer from the user
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for dialogs.
+ * The title for dialogs.
* @param prompt
- * The prompt to tell the user what to enter.
+ * The prompt to tell the user what to enter.
* @return A int.
*/
- public static int getInt(Component parent, String title,
- String prompt) {
+ public static int getInt(Component parent, String title, String prompt) {
return getValue(parent, title, prompt, strang -> {
try {
Integer.parseInt(strang);
return true;
} catch (NumberFormatException nfex) {
- // We don't care about this exception, just mark the value
+ // We don't care about this exception, just mark
+ // the value
// as not good
return false;
}
@@ -138,15 +137,14 @@ public class SimpleDialogs {
* Get a string from the user
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for the dialogs.
+ * The title for the dialogs.
* @param prompt
- * The prompt to tell the user what to enter.
+ * The prompt to tell the user what to enter.
* @return A string.
*/
- public static String getString(Component parent, String title,
- String prompt) {
+ public static String getString(Component parent, String title, String prompt) {
if (parent == null) {
throw new NullPointerException("Parent must not be null");
} else if (title == null) {
@@ -155,30 +153,28 @@ public class SimpleDialogs {
throw new NullPointerException("Prompt must not be null");
}
- return JOptionPane.showInputDialog(parent, prompt, title,
- JOptionPane.QUESTION_MESSAGE);
+ return JOptionPane.showInputDialog(parent, prompt, title, JOptionPane.QUESTION_MESSAGE);
}
/**
* Get a value parsable from a string from the user.
*
* @param <E>
- * The type of the value parsed from the string
+ * The type of the value parsed from the string
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for dialogs.
+ * The title for dialogs.
* @param prompt
- * The prompt to tell the user what to enter.
+ * The prompt to tell the user what to enter.
* @param validator
- * A predicate to determine if a input is valid.
+ * A predicate to determine if a input is valid.
* @param transformer
- * The function to transform the string into a value.
+ * The function to transform the string into a value.
* @return The value parsed from a string.
*/
- public static <E> E getValue(Component parent, String title,
- String prompt, Predicate<String> validator,
+ public static <E> E getValue(Component parent, String title, String prompt, Predicate<String> validator,
Function<String, E> transformer) {
if (validator == null) {
throw new NullPointerException("Validator must not be null");
@@ -201,15 +197,14 @@ public class SimpleDialogs {
* Get a whole number from the user.
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for dialogs.
+ * The title for dialogs.
* @param prompt
- * The prompt to tell the user what to enter.
+ * The prompt to tell the user what to enter.
* @return A whole number.
*/
- public static int getWhole(Component parent, String title,
- String prompt) {
+ public static int getWhole(Component parent, String title, String prompt) {
return getBoundedInt(parent, title, prompt, 0, Integer.MAX_VALUE);
}
@@ -217,15 +212,14 @@ public class SimpleDialogs {
* Ask the user a Yes/No question.
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for dialogs.
+ * The title for dialogs.
* @param question
- * The question to ask the user.
+ * The question to ask the user.
* @return True if the user said yes, false otherwise.
*/
- public static boolean getYesNo(Component parent, String title,
- String question) {
+ public static boolean getYesNo(Component parent, String title, String question) {
if (parent == null) {
throw new NullPointerException("Parent must not be null");
} else if (title == null) {
@@ -234,8 +228,7 @@ public class SimpleDialogs {
throw new NullPointerException("Question must not be null");
}
- int result = JOptionPane.showConfirmDialog(parent, question,
- title, JOptionPane.YES_NO_OPTION);
+ int result = JOptionPane.showConfirmDialog(parent, question, title, JOptionPane.YES_NO_OPTION);
return (result == JOptionPane.YES_OPTION ? true : false);
}
@@ -244,39 +237,35 @@ public class SimpleDialogs {
* Show a error message to the user
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for dialogs.
+ * The title for dialogs.
* @param message
- * The error to show the user.
+ * The error to show the user.
*/
- public static void showError(Component parent, String title,
- String message) {
+ public static void showError(Component parent, String title, String message) {
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 (message == null) {
- throw new NullPointerException(
- "Error message must not be null");
+ throw new NullPointerException("Error message must not be null");
}
- JOptionPane.showMessageDialog(parent, message, title,
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(parent, message, title, JOptionPane.ERROR_MESSAGE);
}
/**
* Show an informative message to the user
*
* @param parent
- * The parent for this dialog
+ * The parent for this dialog
* @param title
- * Show the title for this dialog
+ * Show the title for this dialog
* @param message
- * Show the message for this dialog
+ * Show the message for this dialog
*/
- public static void showMessage(Component parent, String title,
- String message) {
+ public static void showMessage(Component parent, String title, String message) {
if (parent == null) {
throw new NullPointerException("Parent must not be null");
} else if (title == null) {
@@ -285,7 +274,6 @@ public class SimpleDialogs {
throw new NullPointerException("Message must not be null");
}
- JOptionPane.showMessageDialog(parent, title, message,
- JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showMessageDialog(parent, title, message, JOptionPane.INFORMATION_MESSAGE);
}
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleFileChooser.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleFileChooser.java
index ae77e41..ec4b784 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleFileChooser.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleFileChooser.java
@@ -16,8 +16,7 @@ import bjc.utils.exceptions.FileNotChosenException;
*
*/
public class SimpleFileChooser {
- private static File doOpenFile(Component parent, String title,
- JFileChooser files) {
+ private static File doOpenFile(Component parent, String title, JFileChooser files) {
if (title == null) {
throw new NullPointerException("Title must not be null");
}
@@ -33,16 +32,14 @@ public class SimpleFileChooser {
success = true;
} catch (FileNotChosenException fncx) {
// We don't care about specifics
- SimpleDialogs.showError(parent, "I/O Error",
- "Please pick a file to open");
+ SimpleDialogs.showError(parent, "I/O Error", "Please pick a file to open");
}
}
return files.getSelectedFile();
}
- private static File doSaveFile(Component parent, String title,
- JFileChooser files) {
+ private static File doSaveFile(Component parent, String title, JFileChooser files) {
if (title == null) {
throw new NullPointerException("Title must not be null");
}
@@ -58,8 +55,7 @@ public class SimpleFileChooser {
return files.getSelectedFile();
} catch (FileNotChosenException fncex) {
// We don't care about specifics
- SimpleDialogs.showError(parent, "I/O Error",
- "Please pick a file to save to");
+ SimpleDialogs.showError(parent, "I/O Error", "Please pick a file to save to");
}
}
@@ -71,9 +67,9 @@ public class SimpleFileChooser {
* until they pick a file.
*
* @param parent
- * The component to use as the parent for the dialog.
+ * The component to use as the parent for the dialog.
* @param title
- * The title of the dialog to prompt with.
+ * The title of the dialog to prompt with.
* @return The file the user has chosen.
*/
public static File getOpenFile(Component parent, String title) {
@@ -87,15 +83,14 @@ public class SimpleFileChooser {
* until they pick a file.
*
* @param parent
- * The component to use as the parent for the dialog.
+ * The component to use as the parent for the dialog.
* @param title
- * The title of the dialog to prompt with.
+ * The title of the dialog to prompt with.
* @param extensions
- * The list of file extensions the file should have.
+ * The list of file extensions the file should have.
* @return The file the user has chosen.
*/
- public static File getOpenFile(Component parent, String title,
- String... extensions) {
+ public static File getOpenFile(Component parent, String title, String... extensions) {
JFileChooser files = new JFileChooser();
files.addChoosableFileFilter(new ExtensionFileFilter(extensions));
@@ -107,9 +102,9 @@ public class SimpleFileChooser {
* Prompt the user with a "Save File..." dialog.
*
* @param parent
- * The component to use as the parent for the dialog.
+ * The component to use as the parent for the dialog.
* @param title
- * The title of the dialog to prompt with.
+ * The title of the dialog to prompt with.
* @return The file the user chose.
*/
public static File getSaveFile(Component parent, String title) {
@@ -122,15 +117,14 @@ public class SimpleFileChooser {
* Prompt the user with a "Save File..." dialog.
*
* @param parent
- * The component to use as the parent for the dialog.
+ * The component to use as the parent for the dialog.
* @param title
- * The title of the dialog to prompt with.
+ * The title of the dialog to prompt with.
* @param extensions
- * The extensions of the files the user can choose.
+ * The extensions of the files the user can choose.
* @return The file the user chose.
*/
- public static File getSaveFile(Component parent, String title,
- String... extensions) {
+ public static File getSaveFile(Component parent, String title, String... extensions) {
JFileChooser files = new JFileChooser();
files.addChoosableFileFilter(new ExtensionFileFilter(extensions));
@@ -138,13 +132,11 @@ public class SimpleFileChooser {
return doSaveFile(parent, title, files);
}
- private static void maybeDoOpenFile(Component parent,
- JFileChooser files) throws FileNotChosenException {
+ private static void maybeDoOpenFile(Component parent, JFileChooser files) throws FileNotChosenException {
if (parent == null) {
throw new NullPointerException("Parent must not be null");
} else if (files == null) {
- throw new NullPointerException(
- "File chooser must not be null");
+ throw new NullPointerException("File chooser must not be null");
}
int result = files.showSaveDialog(parent);
@@ -154,13 +146,11 @@ public class SimpleFileChooser {
}
}
- private static void maybeDoSaveFile(Component parent,
- JFileChooser files) throws FileNotChosenException {
+ private static void maybeDoSaveFile(Component parent, JFileChooser files) throws FileNotChosenException {
if (parent == null) {
throw new NullPointerException("Parent must not be null");
} else if (files == null) {
- throw new NullPointerException(
- "File chooser must not be null");
+ throw new NullPointerException("File chooser must not be null");
}
int result = files.showSaveDialog(parent);
@@ -174,9 +164,9 @@ public class SimpleFileChooser {
* Prompt the user with a "Open File..." dialog.
*
* @param parent
- * The component to use as the parent for the dialog.
+ * The component to use as the parent for the dialog.
* @param title
- * The title of the dialog to prompt with.
+ * The title of the dialog to prompt with.
* @return The file if the user chose one or null if they didn't.
*/
public static File maybeOpenFile(Component parent, String title) {
@@ -200,9 +190,9 @@ public class SimpleFileChooser {
* Prompt the user with a "Save File..." dialog.
*
* @param parent
- * The component to use as the parent for the dialog.
+ * The component to use as the parent for the dialog.
* @param title
- * The title of the dialog to prompt with.
+ * The title of the dialog to prompt with.
* @return The file if the user chose one or null if they didn't.
*/
public static File maybeSaveFile(Component parent, String title) {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
index 0152870..b5f0d6c 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
@@ -7,7 +7,7 @@ import java.util.function.Predicate;
import javax.swing.JOptionPane;
/**
- * Utility class for getting simple input from the user.
+ * Utility class for getting simple input from the user.
*
* Modified to work with JDesktopPanes
*
@@ -19,26 +19,26 @@ public class SimpleInternalDialogs {
* Get a bounded integer from the user.
*
* @param parent
- * The parent component for the dialogs.
+ * The parent component for the dialogs.
* @param title
- * The title for the dialogs.
+ * The title for the dialogs.
* @param prompt
- * The prompt to tell the user what to enter.
+ * The prompt to tell the user what to enter.
* @param lowerBound
- * The lower integer bound to accept.
+ * The lower integer bound to accept.
* @param upperBound
- * The upper integer bound to accept.
+ * The upper integer bound to accept.
* @return A int within the specified bounds.
*/
- public static int getBoundedInt(Component parent, String title,
- String prompt, int lowerBound, int upperBound) {
+ public static int getBoundedInt(Component parent, String title, String prompt, int lowerBound, int upperBound) {
return getValue(parent, title, prompt, (strang) -> {
try {
int value = Integer.parseInt(strang);
return (value < upperBound) && (value > lowerBound);
} catch (NumberFormatException nfex) {
- // We don't care about the specifics of the exception, just
+ // We don't care about the specifics of the
+ // exception, just
// that this value isn't good
return false;
}
@@ -49,21 +49,21 @@ public class SimpleInternalDialogs {
* Get a integer from the user
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for dialogs.
+ * The title for dialogs.
* @param prompt
- * The prompt to tell the user what to enter.
+ * The prompt to tell the user what to enter.
* @return A int.
*/
- public static int getInt(Component parent, String title,
- String prompt) {
+ public static int getInt(Component parent, String title, String prompt) {
return getValue(parent, title, prompt, strang -> {
try {
Integer.parseInt(strang);
return true;
} catch (NumberFormatException nfex) {
- // We don't care about this exception, just mark the value
+ // We don't care about this exception, just mark
+ // the value
// as not good
return false;
}
@@ -74,15 +74,14 @@ public class SimpleInternalDialogs {
* Get a string from the user
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for the dialogs.
+ * The title for the dialogs.
* @param prompt
- * The prompt to tell the user what to enter.
+ * The prompt to tell the user what to enter.
* @return A string.
*/
- public static String getString(Component parent, String title,
- String prompt) {
+ public static String getString(Component parent, String title, String prompt) {
if (parent == null) {
throw new NullPointerException("Parent must not be null");
} else if (title == null) {
@@ -91,30 +90,28 @@ public class SimpleInternalDialogs {
throw new NullPointerException("Prompt must not be null");
}
- return JOptionPane.showInternalInputDialog(parent, prompt, title,
- JOptionPane.QUESTION_MESSAGE);
+ return JOptionPane.showInternalInputDialog(parent, prompt, title, JOptionPane.QUESTION_MESSAGE);
}
/**
* Get a value parsable from a string from the user.
*
* @param <E>
- * The type of the value parsed from the string
+ * The type of the value parsed from the string
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for dialogs.
+ * The title for dialogs.
* @param prompt
- * The prompt to tell the user what to enter.
+ * The prompt to tell the user what to enter.
* @param validator
- * A predicate to determine if a input is valid.
+ * A predicate to determine if a input is valid.
* @param transformer
- * The function to transform the string into a value.
+ * The function to transform the string into a value.
* @return The value parsed from a string.
*/
- public static <E> E getValue(Component parent, String title,
- String prompt, Predicate<String> validator,
+ public static <E> E getValue(Component parent, String title, String prompt, Predicate<String> validator,
Function<String, E> transformer) {
if (validator == null) {
throw new NullPointerException("Validator must not be null");
@@ -137,15 +134,14 @@ public class SimpleInternalDialogs {
* Get a whole number from the user.
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for dialogs.
+ * The title for dialogs.
* @param prompt
- * The prompt to tell the user what to enter.
+ * The prompt to tell the user what to enter.
* @return A whole number.
*/
- public static int getWhole(Component parent, String title,
- String prompt) {
+ public static int getWhole(Component parent, String title, String prompt) {
return getBoundedInt(parent, title, prompt, 0, Integer.MAX_VALUE);
}
@@ -153,15 +149,14 @@ public class SimpleInternalDialogs {
* Ask the user a Yes/No question.
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for dialogs.
+ * The title for dialogs.
* @param question
- * The question to ask the user.
+ * The question to ask the user.
* @return True if the user said yes, false otherwise.
*/
- public static boolean getYesNo(Component parent, String title,
- String question) {
+ public static boolean getYesNo(Component parent, String title, String question) {
if (parent == null) {
throw new NullPointerException("Parent must not be null");
} else if (title == null) {
@@ -170,8 +165,7 @@ public class SimpleInternalDialogs {
throw new NullPointerException("Question must not be null");
}
- int result = JOptionPane.showInternalConfirmDialog(parent,
- question, title, JOptionPane.YES_NO_OPTION);
+ int result = JOptionPane.showInternalConfirmDialog(parent, question, title, JOptionPane.YES_NO_OPTION);
return (result == JOptionPane.YES_OPTION ? true : false);
}
@@ -180,39 +174,35 @@ public class SimpleInternalDialogs {
* Show a error message to the user
*
* @param parent
- * The parent component for dialogs.
+ * The parent component for dialogs.
* @param title
- * The title for dialogs.
+ * The title for dialogs.
* @param message
- * The error to show the user.
+ * The error to show the user.
*/
- public static void showError(Component parent, String title,
- String message) {
+ public static void showError(Component parent, String title, String message) {
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 (message == null) {
- throw new NullPointerException(
- "Error message must not be null");
+ throw new NullPointerException("Error message must not be null");
}
- JOptionPane.showInternalMessageDialog(parent, message, title,
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showInternalMessageDialog(parent, message, title, JOptionPane.ERROR_MESSAGE);
}
/**
* Show an informative message to the user
*
* @param parent
- * The parent for this dialog
+ * The parent for this dialog
* @param title
- * Show the title for this dialog
+ * Show the title for this dialog
* @param message
- * Show the message for this dialog
+ * Show the message for this dialog
*/
- public static void showMessage(Component parent, String title,
- String message) {
+ public static void showMessage(Component parent, String title, String message) {
if (parent == null) {
throw new NullPointerException("Parent must not be null");
} else if (title == null) {
@@ -221,7 +211,6 @@ public class SimpleInternalDialogs {
throw new NullPointerException("Message must not be null");
}
- JOptionPane.showInternalMessageDialog(parent, title, message,
- JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showInternalMessageDialog(parent, title, message, JOptionPane.INFORMATION_MESSAGE);
}
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalFrame.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalFrame.java
index a7f2183..4fe23e1 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalFrame.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalFrame.java
@@ -22,7 +22,7 @@ public class SimpleInternalFrame extends JInternalFrame {
* Create a new blank internal frame with a specific title
*
* @param title
- * The title of the internal frame
+ * The title of the internal frame
*/
public SimpleInternalFrame(String title) {
super(title);
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleJList.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleJList.java
index 136c662..0cac1c9 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleJList.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleJList.java
@@ -15,10 +15,10 @@ public class SimpleJList {
* Create a new JList from a given list.
*
* @param <E>
- * The type of data in the JList
+ * The type of data in the JList
*
* @param source
- * The list to populate the JList with.
+ * The list to populate the JList with.
* @return A JList populated with the elements from ls.
*/
public static <E> JList<E> buildFromList(Iterable<E> source) {
@@ -33,10 +33,10 @@ public class SimpleJList {
* Create a new list model from a given list.
*
* @param <E>
- * The type of data in the list model
+ * The type of data in the list model
*
* @param source
- * The list to fill the list model from.
+ * The list to fill the list model from.
* @return A list model populated with the elements from ls.
*/
public static <E> ListModel<E> buildModel(Iterable<E> source) {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleTitledBorder.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleTitledBorder.java
index e2fd390..75d89e7 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleTitledBorder.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleTitledBorder.java
@@ -17,7 +17,7 @@ public class SimpleTitledBorder extends TitledBorder {
* Create a new border with the specified title.
*
* @param title
- * The title for the border.
+ * The title for the border.
*/
public SimpleTitledBorder(String title) {
super(new EtchedBorder(), title);
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/TextAreaOutputStream.java b/BJC-Utils2/src/main/java/bjc/utils/gui/TextAreaOutputStream.java
index 6ff716b..2fab8be 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/TextAreaOutputStream.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/TextAreaOutputStream.java
@@ -18,7 +18,7 @@ public class TextAreaOutputStream extends OutputStream {
* Create a new output stream attached to a textarea
*
* @param console
- * The textarea to write to
+ * The textarea to write to
*/
public TextAreaOutputStream(JTextArea console) {
this.textArea = console;
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/awt/ExtensionFileFilter.java b/BJC-Utils2/src/main/java/bjc/utils/gui/awt/ExtensionFileFilter.java
index a375a98..0990f4f 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/awt/ExtensionFileFilter.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/awt/ExtensionFileFilter.java
@@ -22,11 +22,10 @@ public class ExtensionFileFilter implements FilenameFilter {
private IList<String> extensions;
/**
- * Create a new filter only showing files with the specified
- * 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(List<String> exts) {
if (exts == null) {
@@ -37,11 +36,10 @@ public class ExtensionFileFilter implements FilenameFilter {
}
/**
- * Create a new filter only showing files with the specified
- * 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(String... exts) {
extensions = new FunctionalList<>(exts);
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 280c5d8..041a9a2 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
@@ -20,9 +20,9 @@ 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
*/
public static File getOpenFile(Frame parent, String title) {
@@ -33,23 +33,21 @@ 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(Frame parent, String title,
- String... extensions) {
+ public static File getOpenFile(Frame parent, String title, 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");
}
- FileDialog chooser = new FileDialog(parent, title,
- FileDialog.LOAD);
+ FileDialog chooser = new FileDialog(parent, title, FileDialog.LOAD);
if (extensions != null) {
FilenameFilter filter = new ExtensionFileFilter(extensions);
@@ -59,8 +57,7 @@ public class SimpleFileDialog {
chooser.setVisible(true);
while (chooser.getFile() == null) {
- SimpleDialogs.showError(parent, "File I/O Error",
- "Please choose a file to open.");
+ SimpleDialogs.showError(parent, "File I/O Error", "Please choose a file to open.");
chooser.setVisible(true);
}
@@ -71,23 +68,21 @@ 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(Frame parent, String title,
- String... extensions) {
+ public static File[] getOpenFiles(Frame parent, String title, 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");
}
- FileDialog chooser = new FileDialog(parent, title,
- FileDialog.LOAD);
+ FileDialog chooser = new FileDialog(parent, title, FileDialog.LOAD);
if (extensions != null) {
FilenameFilter filter = new ExtensionFileFilter(extensions);
@@ -98,8 +93,7 @@ public class SimpleFileDialog {
chooser.setVisible(true);
while (chooser.getFile() == null) {
- SimpleDialogs.showError(parent, "File I/O Error",
- "Please choose a file to open.");
+ SimpleDialogs.showError(parent, "File I/O Error", "Please choose a file to open.");
chooser.setVisible(true);
}
@@ -110,9 +104,9 @@ 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
*/
public static File getSaveFile(Frame parent, String title) {
@@ -123,23 +117,21 @@ 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(Frame parent, String title,
- String... extensions) {
+ public static File getSaveFile(Frame parent, String title, 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");
}
- FileDialog chooser = new FileDialog(parent, title,
- FileDialog.SAVE);
+ FileDialog chooser = new FileDialog(parent, title, FileDialog.SAVE);
if (extensions != null) {
FilenameFilter filter = new ExtensionFileFilter(extensions);
@@ -149,8 +141,7 @@ public class SimpleFileDialog {
chooser.setVisible(true);
while (chooser.getFile() == null) {
- SimpleDialogs.showError(parent, "File I/O Error",
- "Please choose a file to save to.");
+ SimpleDialogs.showError(parent, "File I/O Error", "Please choose a file to save to.");
chooser.setVisible(true);
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java b/BJC-Utils2/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java
index d8a60ed..07acd56 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java
@@ -3,8 +3,8 @@ package bjc.utils.gui.layout;
import java.awt.GridLayout;
/**
- * A layout that simply holds one component that it auto-resizes whenever
- * it is resized.
+ * A layout that simply holds one component that it auto-resizes whenever it is
+ * resized.
*
* @author ben
*
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/layout/HLayout.java b/BJC-Utils2/src/main/java/bjc/utils/gui/layout/HLayout.java
index c986310..3380321 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/layout/HLayout.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/layout/HLayout.java
@@ -3,8 +3,8 @@ package bjc.utils.gui.layout;
import java.awt.GridLayout;
/**
- * A layout manager that lays out its components horizontally, evenly
- * sizing them.
+ * A layout manager that lays out its components horizontally, evenly sizing
+ * them.
*
* @author ben
*
@@ -17,7 +17,7 @@ public class HLayout extends GridLayout {
* 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(int columns) {
super(1, columns);
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/layout/VLayout.java b/BJC-Utils2/src/main/java/bjc/utils/gui/layout/VLayout.java
index 5951ba5..fdae31e 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/layout/VLayout.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/layout/VLayout.java
@@ -3,8 +3,8 @@ package bjc.utils.gui.layout;
import java.awt.GridLayout;
/**
- * A layout that lays out its components vertically, evenly sharing space
- * among them.
+ * A layout that lays out its components vertically, evenly sharing space among
+ * them.
*
* @author ben
*
@@ -17,7 +17,7 @@ public class VLayout extends GridLayout {
* Create a new vertical layout with the specified number of rows.
*
* @param rows
- * The number of rows.
+ * The number of rows.
*/
public VLayout(int rows) {
super(rows, 1);
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java
index 895faa6..f2d7f7b 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java
@@ -26,16 +26,15 @@ public class DropdownListPanel extends JPanel {
* Create a new dropdown list panel
*
* @param <T>
- * The type of items in the dropdown list
+ * The type of items in the dropdown list
* @param type
- * The label of the type of items in the list
+ * The label of the type of items in the list
* @param model
- * The model to put items into
+ * The model to put items into
* @param choices
- * The items to choose from
+ * The items to choose from
*/
- public <T> DropdownListPanel(String type,
- DefaultListModel<T> model, IList<T> choices) {
+ public <T> DropdownListPanel(String type, DefaultListModel<T> model, IList<T> choices) {
setLayout(new AutosizeLayout());
JPanel itemInputPanel = new JPanel();
@@ -58,8 +57,7 @@ public class DropdownListPanel extends JPanel {
JButton removeItemButton = new JButton("Remove " + type);
addItemButton.addActionListener((ev) -> {
- model.addElement(
- addItemBox.getItemAt(addItemBox.getSelectedIndex()));
+ model.addElement(addItemBox.getItemAt(addItemBox.getSelectedIndex()));
});
removeItemButton.addActionListener((ev) -> {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/FormattedInputPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/FormattedInputPanel.java
index a05c06e..ae62a43 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/FormattedInputPanel.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/FormattedInputPanel.java
@@ -15,29 +15,27 @@ import bjc.utils.gui.layout.HLayout;
* @author ben
*
* @param <InputVal>
- * The type of value being formatted
+ * The type of value being formatted
*/
public class FormattedInputPanel<InputVal> extends JPanel {
- private static final long serialVersionUID = 5232016563558588031L;
+ private static final long serialVersionUID = 5232016563558588031L;
- private JFormattedTextField field;
+ private JFormattedTextField field;
/**
* Create a new formatted input panel
*
* @param label
- * The label for this panel
+ * The label for this panel
* @param length
- * The length of this panel
+ * The length of this panel
* @param formatter
- * The formatter to use for input
+ * The formatter to use for input
* @param reciever
- * The action to call whenever the value changes
+ * The action to call whenever the value changes
*/
@SuppressWarnings("unchecked")
- public FormattedInputPanel(String label, int length,
- AbstractFormatter formatter,
- Consumer<InputVal> reciever) {
+ public FormattedInputPanel(String label, int length, AbstractFormatter formatter, Consumer<InputVal> reciever) {
setLayout(new HLayout(2));
JLabel lab = new JLabel(label);
@@ -59,7 +57,7 @@ public class FormattedInputPanel<InputVal> extends JPanel {
* Reset the value in this panel to a specified value
*
* @param value
- * The value to set the panel to
+ * The value to set the panel to
*/
public void resetValues(InputVal value) {
field.setValue(value);
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/HolderOutputPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/HolderOutputPanel.java
index f7f2c26..b6fc807 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/HolderOutputPanel.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/HolderOutputPanel.java
@@ -14,25 +14,24 @@ import bjc.utils.gui.layout.HLayout;
*
*/
public class HolderOutputPanel extends JPanel {
- private static final long serialVersionUID = 166573313903782080L;
+ private static final long serialVersionUID = 166573313903782080L;
- private Timer updater;
- private JLabel value;
- private int nDelay;
- private IHolder<String> val;
+ private Timer updater;
+ private JLabel value;
+ private int nDelay;
+ private IHolder<String> val;
/**
* Create a new display panel, backed by a holder
*
* @param lab
- * The label to attach to this field
+ * The label to attach to this field
* @param valueHolder
- * The holder to get the value from
+ * The holder to get the value from
* @param nDelay
- * The delay in ms between value updates
+ * The delay in ms between value updates
*/
- public HolderOutputPanel(String lab, IHolder<String> valueHolder,
- int nDelay) {
+ public HolderOutputPanel(String lab, IHolder<String> valueHolder, int nDelay) {
this.val = valueHolder;
this.nDelay = nDelay;
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/ListParameterPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/ListParameterPanel.java
index 088be6c..29ede89 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/ListParameterPanel.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/ListParameterPanel.java
@@ -20,7 +20,7 @@ import bjc.utils.gui.layout.VLayout;
* @author ben
*
* @param <E>
- * The type of data stored in the list
+ * The type of data stored in the list
*/
public class ListParameterPanel<E> extends JPanel {
// Version id for serialization
@@ -30,14 +30,13 @@ public class ListParameterPanel<E> extends JPanel {
* Create a new panel using the specified actions for doing things
*
* @param add
- * The action that provides items
+ * The action that provides items
* @param edit
- * The action that edits items
+ * The action that edits items
* @param remove
- * The action that removes items
+ * The action that removes items
*/
- public ListParameterPanel(Supplier<E> add,
- Consumer<E> edit, Consumer<E> remove) {
+ public ListParameterPanel(Supplier<E> add, Consumer<E> edit, Consumer<E> remove) {
this(add, edit, remove, null);
}
@@ -45,17 +44,15 @@ public class ListParameterPanel<E> extends JPanel {
* Create a new panel using the specified actions for doing things
*
* @param add
- * The action that provides items
+ * The action that provides items
* @param edit
- * The action that edits items
+ * The action that edits items
* @param remove
- * The action that removes items
+ * The action that removes items
* @param defaults
- * The default values to put in the list
+ * The default values to put in the list
*/
- public ListParameterPanel(Supplier<E> add,
- Consumer<E> edit, Consumer<E> remove,
- IList<E> defaults) {
+ public ListParameterPanel(Supplier<E> add, Consumer<E> edit, Consumer<E> remove, IList<E> defaults) {
setLayout(new VLayout(2));
JList<E> list;
@@ -91,8 +88,7 @@ public class ListParameterPanel<E> extends JPanel {
if (add != null) {
addParam = new JButton("Add...");
addParam.addActionListener((event) -> {
- DefaultListModel<
- E> model = (DefaultListModel<E>) list.getModel();
+ DefaultListModel<E> model = (DefaultListModel<E>) list.getModel();
model.addElement(add.get());
});
@@ -112,8 +108,7 @@ public class ListParameterPanel<E> extends JPanel {
if (remove != null) {
removeParam = new JButton("Remove...");
removeParam.addActionListener((event) -> {
- DefaultListModel<
- E> model = (DefaultListModel<E>) list.getModel();
+ DefaultListModel<E> model = (DefaultListModel<E>) list.getModel();
remove.accept(model.remove(list.getSelectedIndex()));
});
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java
index eb900aa..b90e25c 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java
@@ -8,21 +8,25 @@ import javax.swing.JTextField;
/**
* A simple component for text input
+ *
* @author ben
*
*/
public class SimpleInputPanel extends JPanel {
- private static final long serialVersionUID = -4734279623645236868L;
+ private static final long serialVersionUID = -4734279623645236868L;
/**
* The text field containing the input value
*/
- public final JTextField inputValue;
+ public final JTextField inputValue;
/**
* Create a new input panel
- * @param label The label for the field
- * @param columns The number of columns of text input to take
+ *
+ * @param label
+ * The label for the field
+ * @param columns
+ * The number of columns of text input to take
*/
public SimpleInputPanel(String label, int columns) {
setLayout(new BorderLayout());
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java
index 48230dd..11b209f 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java
@@ -24,10 +24,8 @@ import bjc.utils.gui.layout.HLayout;
public class SimpleListPanel extends JPanel {
private static final long serialVersionUID = 2719963952350133541L;
- private static void addItem(DefaultListModel<String> model,
- Predicate<String> verifier,
- Consumer<String> onFailure,
- JTextField addItemField) {
+ private static void addItem(DefaultListModel<String> model, Predicate<String> verifier,
+ Consumer<String> onFailure, JTextField addItemField) {
String potentialItem = addItemField.getText();
if (verifier == null || verifier.test(potentialItem)) {
@@ -43,17 +41,15 @@ public class SimpleListPanel extends JPanel {
* Create a new list panel
*
* @param type
- * The type of things in the list
+ * The type of things in the list
* @param model
- * The model to put items into
+ * The model to put items into
* @param verifier
- * The predicate to use to verify items
+ * The predicate to use to verify items
* @param onFailure
- * The function to call when an item doesn't verify
+ * The function to call when an item doesn't verify
*/
- public SimpleListPanel(String type,
- DefaultListModel<String> model,
- Predicate<String> verifier,
+ public SimpleListPanel(String type, DefaultListModel<String> model, Predicate<String> verifier,
Consumer<String> onFailure) {
setLayout(new AutosizeLayout());
@@ -77,13 +73,11 @@ public class SimpleListPanel extends JPanel {
JButton removeItemButton = new JButton("Remove " + type);
addItemButton.addActionListener((ev) -> {
- addItem(model, verifier, onFailure,
- addItemField);
+ addItem(model, verifier, onFailure, addItemField);
});
addItemField.addActionListener((ev) -> {
- addItem(model, verifier, onFailure,
- addItemField);
+ addItem(model, verifier, onFailure, addItemField);
});
removeItemButton.addActionListener((ev) -> {
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java
index 5996b65..e9e94d5 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java
@@ -9,21 +9,25 @@ import javax.swing.SpinnerModel;
/**
* A simple spinner control
+ *
* @author ben
*
*/
public class SimpleSpinnerPanel extends JPanel {
- private static final long serialVersionUID = -4734279623645236868L;
+ private static final long serialVersionUID = -4734279623645236868L;
/*
* The spinner being used
*/
- public final JSpinner inputValue;
+ public final JSpinner inputValue;
/**
* Create a new spinner panel
- * @param label The label for the spinner
- * @param model The model to attach to the spinner
+ *
+ * @param label
+ * The label for the spinner
+ * @param model
+ * The model to attach to the spinner
*/
public SimpleSpinnerPanel(String label, SpinnerModel model) {
setLayout(new BorderLayout());
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SliderInputPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SliderInputPanel.java
index 9de4d63..53bff32 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SliderInputPanel.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SliderInputPanel.java
@@ -11,21 +11,20 @@ import javax.swing.JSlider;
import bjc.utils.gui.layout.HLayout;
/**
- * A simple input panel for a slider-controlled value and a manual-input
- * field for setting the slider
+ * A simple input panel for a slider-controlled value and a manual-input field
+ * for setting the slider
*
* @author ben
*
*/
public class SliderInputPanel extends JPanel {
- private final class NumberFormatter
- extends JFormattedTextField.AbstractFormatter {
- private static final long serialVersionUID = -4448291795913908270L;
+ private final class NumberFormatter extends JFormattedTextField.AbstractFormatter {
+ private static final long serialVersionUID = -4448291795913908270L;
- private int minValue;
- private int maxValue;
+ private int minValue;
+ private int maxValue;
- private int initValue;
+ private int initValue;
public NumberFormatter(SliderSettings settings) {
minValue = settings.minValue;
@@ -40,17 +39,14 @@ public class SliderInputPanel extends JPanel {
int val = Integer.parseInt(text);
if (val < minValue) {
- throw new ParseException(
- "Value must be greater than " + minValue, 0);
+ throw new ParseException("Value must be greater than " + minValue, 0);
} else if (val > maxValue) {
- throw new ParseException(
- "Value must be smaller than " + maxValue, 0);
+ throw new ParseException("Value must be smaller than " + maxValue, 0);
} else {
return val;
}
} catch (NumberFormatException nfex) {
- ParseException pex = new ParseException(
- "Value must be a valid integer", 0);
+ ParseException pex = new ParseException("Value must be a valid integer", 0);
pex.initCause(nfex);
@@ -78,25 +74,25 @@ public class SliderInputPanel extends JPanel {
/**
* The minimum value of the slider
*/
- public final int minValue;
+ public final int minValue;
/**
* The maximum value of the slider
*/
- public final int maxValue;
+ public final int maxValue;
/**
* The initial value of the slider
*/
- public final int initValue;
+ public final int initValue;
/**
* Create a new slider settings, with the initial value in the
* middle
*
* @param min
- * The minimum value of the slider
+ * The minimum value of the slider
* @param max
- * The maximum value of the slider
+ * The maximum value of the slider
*/
public SliderSettings(int min, int max) {
this(min, max, (min + max) / 2);
@@ -106,11 +102,11 @@ public class SliderInputPanel extends JPanel {
* Create a new set of slider sttings
*
* @param min
- * The minimum slider value
+ * The minimum slider value
* @param max
- * The maximum slider value
+ * The maximum slider value
* @param init
- * Th initial slider value
+ * Th initial slider value
*/
public SliderSettings(int min, int max, int init) {
minValue = min;
@@ -120,32 +116,31 @@ public class SliderInputPanel extends JPanel {
}
}
- private static final long serialVersionUID = 2956394160569961404L;
- private JSlider slider;
- private JFormattedTextField field;
+ private static final long serialVersionUID = 2956394160569961404L;
+ private JSlider slider;
+ private JFormattedTextField field;
/**
* Create a new slider input panel
*
* @param lab
- * The label for the field
+ * The label for the field
* @param settings
- * The settings for slider values
+ * The settings for slider values
* @param majorTick
- * The setting for where to place big ticks
+ * The setting for where to place big ticks
* @param minorTick
- * The setting for where to place small ticks
+ * The setting for where to place small ticks
* @param action
- * The action to execute for a given value
+ * The action to execute for a given value
*/
- public SliderInputPanel(String lab, SliderSettings settings,
- int majorTick, int minorTick, Consumer<Integer> action) {
+ public SliderInputPanel(String lab, SliderSettings settings, int majorTick, int minorTick,
+ Consumer<Integer> action) {
setLayout(new HLayout(3));
JLabel label = new JLabel(lab);
- slider = new JSlider(settings.minValue, settings.maxValue,
- settings.initValue);
+ slider = new JSlider(settings.minValue, settings.maxValue, settings.initValue);
field = new JFormattedTextField(new NumberFormatter(settings));
slider.setMajorTickSpacing(majorTick);
@@ -186,7 +181,7 @@ public class SliderInputPanel extends JPanel {
* Reset the values in this panel to a specified value
*
* @param value
- * The value to reset the fields to
+ * The value to reset the fields to
*/
public void resetValues(int value) {
slider.setValue(value);