diff --git a/Alex's Aspect Ratio Calculator.jar b/Alex's Aspect Ratio Calculator.jar index 29528fd..230b25f 100644 Binary files a/Alex's Aspect Ratio Calculator.jar and b/Alex's Aspect Ratio Calculator.jar differ diff --git a/README.md b/README.md index 8122e0b..d7259b7 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Should work on any desktop operating system that can run Java 8. Designed and bu Changelog: +- Version 0.4 Alpha - Fixes crash when calculating aspect ratio with "0" as input for width/height - Version 0.3 Alpha - Adds input validation for negative numbers - Version 0.2 Alpha - Bugfix: Crash when entering non-integer characters - Version 0.1 Alpha - Initial Release @@ -12,12 +13,11 @@ Changelog: Known Bugs: - UI elements can be misaligned -- Running "calculate" with "0" in fields crashes the application TODO: -- Toggle switch for dark mode -- Add dark mode in error messages +- Add a toggle switch for dark mode +- Add dark mode style inside of error messages - Evaluate whether logic to reject numbers that are too large is needed - Come up with a way to auto-merge AARC.jar //TODO(s) into readme diff --git a/bin/notalexnoyle/AARC$1.class b/bin/notalexnoyle/AARC$1.class index 04ae536..2906a58 100644 Binary files a/bin/notalexnoyle/AARC$1.class and b/bin/notalexnoyle/AARC$1.class differ diff --git a/src/notalexnoyle/AARC.java b/src/notalexnoyle/AARC.java index b993326..3504a0b 100644 --- a/src/notalexnoyle/AARC.java +++ b/src/notalexnoyle/AARC.java @@ -188,30 +188,30 @@ public class AARC { // Final valid integer testing conditional: means IF both fields are valid integers: do this else { - // Nested conditionals to display proper error messages based on which fields are negative (therefore, invalid) + // Nested conditionals to display proper error messages based on which fields are negative or zero (therefore, invalid) - // If width and height are both negative: do this - if(Integer.valueOf(widthEntry.getText()) < 0 && Integer.valueOf(heightEntry.getText()) < 0) { + // If width and height are both negative or zero: do this + if(Integer.valueOf(widthEntry.getText()) <= 0 && Integer.valueOf(heightEntry.getText()) <= 0) { // Display error message with formatted title - JOptionPane.showMessageDialog(null, "It is not possible to have a negative width and height. Please enter positive values and try again.", "Error", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(null, "Please enter a width and height larger than zero.", "Error", JOptionPane.INFORMATION_MESSAGE); } - // If only width is negative: do this - else if(Integer.valueOf(widthEntry.getText()) < 0 && Integer.valueOf(heightEntry.getText()) >= 0) { + // If only width is negative or zero: do this + else if(Integer.valueOf(widthEntry.getText()) <= 0 && Integer.valueOf(heightEntry.getText()) > 0) { // Display error message with formatted title - JOptionPane.showMessageDialog(null, "It is not possible to have a negative width. Please enter a positive value and try again.", "Error", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(null, "Please enter a width larger than zero.", "Error", JOptionPane.INFORMATION_MESSAGE); } - // If only height is negative: do this - else if(Integer.valueOf(heightEntry.getText()) < 0 && Integer.valueOf(widthEntry.getText()) >= 0) { + // If only height is negative or zero: do this + else if(Integer.valueOf(heightEntry.getText()) <= 0 && Integer.valueOf(widthEntry.getText()) > 0) { // Display error message with formatted title - JOptionPane.showMessageDialog(null, "It is not possible to have a negative height. Please enter a positive value and try again", "Error", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(null, "Please enter a height larger than zero", "Error", JOptionPane.INFORMATION_MESSAGE); } - // Final negative number conditional --> If both fields are both valid, positive numbers: do this + // Final negative or zero number conditional --> If both fields are both valid, positive, non-zero numbers: do this else { // Set display label to result { pass in user entry Integer derived from String to math methods };