mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow to save only valid int value that fit bounds
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user