allow to save only valid int value that fit bounds

This commit is contained in:
Dmitry.Krasilschikov
2019-01-23 18:50:24 +02:00
parent 067076297a
commit 3a3e0fd2f3
@@ -194,7 +194,8 @@ public interface Configurable extends UnnamedConfigurable {
default boolean isModified(@NotNull JTextField textField, int value, @NotNull UINumericRange range) {
try {
return range.fit(Integer.parseInt(textField.getText().trim())) != value;
int currentValue = Integer.parseInt(textField.getText().trim());
return range.fit(currentValue) == currentValue && currentValue != value;
}
catch (NumberFormatException e) {
return false;