summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2018-02-12 22:45:04 -0500
committerbjculkin <bjculkin@mix.wvu.edu>2018-02-12 22:45:04 -0500
commitdf94066e3af02ff02d5ab4d033a3d603f743234c (patch)
tree168a1edaf58d386c175ffb601e9d4da8e13d31e2 /base/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
parentae51c587c53f7ca311e556e3cbd0c5566d6c2843 (diff)
Formatting pass
Diffstat (limited to 'base/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java')
-rw-r--r--base/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java92
1 files changed, 46 insertions, 46 deletions
diff --git a/base/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java b/base/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
index 5237557..ef56011 100644
--- a/base/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
+++ b/base/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
@@ -19,15 +19,15 @@ 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(final Component parent, final String title, final String prompt,
@@ -37,7 +37,7 @@ public class SimpleInternalDialogs {
final int value = Integer.parseInt(strang);
return value < upperBound && value > lowerBound;
- } catch (final NumberFormatException nfex) {
+ } catch(final NumberFormatException nfex) {
// We don't care about the specifics of the
// exception, just
// that this value isn't good
@@ -50,11 +50,11 @@ 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(final Component parent, final String title, final String prompt) {
@@ -62,7 +62,7 @@ public class SimpleInternalDialogs {
try {
Integer.parseInt(strang);
return true;
- } catch (final NumberFormatException nfex) {
+ } catch(final NumberFormatException nfex) {
// We don't care about this exception, just mark
// the value
// as not good
@@ -75,19 +75,19 @@ 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(final Component parent, final String title, final String prompt) {
- if (parent == null)
+ 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");
- else if (prompt == null) throw new NullPointerException("Prompt must not be null");
+ else if(prompt == null) throw new NullPointerException("Prompt must not be null");
return JOptionPane.showInternalInputDialog(parent, prompt, title, JOptionPane.QUESTION_MESSAGE);
}
@@ -96,29 +96,29 @@ public class SimpleInternalDialogs {
* 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(final Component parent, final String title, final String prompt,
final Predicate<String> validator, final Function<String, E> transformer) {
- if (validator == null)
+ if(validator == null)
throw new NullPointerException("Validator must not be null");
- else if (transformer == null) throw new NullPointerException("Transformer must not be null");
+ else if(transformer == null) throw new NullPointerException("Transformer must not be null");
String strang = getString(parent, title, prompt);
- while (!validator.test(strang)) {
+ while(!validator.test(strang)) {
showError(parent, "I/O Error", "Please enter a valid value");
strang = getString(parent, title, prompt);
@@ -131,11 +131,11 @@ 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(final Component parent, final String title, final String prompt) {
@@ -146,19 +146,19 @@ 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(final Component parent, final String title, final String question) {
- if (parent == null)
+ 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");
- else if (question == null) throw new NullPointerException("Question must not be null");
+ else if(question == null) throw new NullPointerException("Question must not be null");
final int result = JOptionPane.showInternalConfirmDialog(parent, question, title,
JOptionPane.YES_NO_OPTION);
@@ -170,18 +170,18 @@ 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(final Component parent, final String title, final String message) {
- if (parent == null)
+ 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");
- else if (message == null) throw new NullPointerException("Error message must not be null");
+ else if(message == null) throw new NullPointerException("Error message must not be null");
JOptionPane.showInternalMessageDialog(parent, message, title, JOptionPane.ERROR_MESSAGE);
}
@@ -190,18 +190,18 @@ public class SimpleInternalDialogs {
* 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(final Component parent, final String title, final String message) {
- if (parent == null)
+ 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");
- else if (message == null) throw new NullPointerException("Message must not be null");
+ else if(message == null) throw new NullPointerException("Message must not be null");
JOptionPane.showInternalMessageDialog(parent, title, message, JOptionPane.INFORMATION_MESSAGE);
}