diff --git a/src/main/java/io/github/dsheirer/gui/control/IntegerFormatter.java b/src/main/java/io/github/dsheirer/gui/control/IntegerFormatter.java index 1e013e23..5937417d 100644 --- a/src/main/java/io/github/dsheirer/gui/control/IntegerFormatter.java +++ b/src/main/java/io/github/dsheirer/gui/control/IntegerFormatter.java @@ -85,7 +85,7 @@ public class IntegerFormatter extends TextFormatter public Change apply(Change change) { //Only validate if the user added text to the control. Otherwise, allow it to go through - if(change.getText() != null) + if(!change.getText().equals("")) { String updatedText = change.getControlNewText(); @@ -93,6 +93,12 @@ public class IntegerFormatter extends TextFormatter { return change; } + + // don't validate yet if input is only a minus sign + if(updatedText.equals("-")) + { + return change; + } if(!updatedText.matches(DECIMAL_REGEX) || !isValid(updatedText)) {