3.0.2 - Made error message make more sense

This commit is contained in:
NotAlexNoyle committed 2017-12-14 00:30:16 -05:00
1 parent cd7351e4c0
commit 63691d6bfb
4 files changed
+8 -5

No files matched your search

BIN
View File
Binary file not shown.
Binary file not shown.
+5 -5
View File
@@ -14,9 +14,9 @@ public class Eobard {
String stringToReverse = JOptionPane.showInputDialog(null, "Text To Reverse:", "Eobard", JOptionPane.INFORMATION_MESSAGE);
// Keeps track of whether or not the user input is blank
boolean isPopulated = false;
boolean hasCharacters = false;
// Runs while user input is blank
while(isPopulated == false) {
while(hasCharacters == false) {
// Checks individual characters to see if they are comprised of only whitespace
for(int i = 0; i < stringToReverse.length(); i++) {
@@ -25,17 +25,17 @@ public class Eobard {
if(Character.isWhitespace(stringToReverse.charAt(i)) == false) {
// Breaks out of loops when user input contains non-whitespace characters
isPopulated = true;
hasCharacters = true;
}
}
// Runs if user input is whitespace
if(! isPopulated) {
if(hasCharacters == false) {
// Asks user to re-enter their input so that it is not blank (until it is or the user closes the program). Passes the value to original input string for re-evaluation
stringToReverse = JOptionPane.showInputDialog(null, "You left the search field blank, please try again:", "Eobard", JOptionPane.INFORMATION_MESSAGE);
stringToReverse = JOptionPane.showInputDialog(null, "You left the field blank. Please try again. Text To Reverse: ", "Eobard", JOptionPane.INFORMATION_MESSAGE);
}
+3
View File
@@ -4,6 +4,9 @@ A Java desktop application for reversing any text quickly and elegantly. Built w
Changelog:
- Version 3.0.2:
- Made error message make more sense
- Version 3.0.1:
- Simplified input validation code