blob: 07a0369f7565277182309f75099d4991ca8915a4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package NET.worlds.scape;
class IntegerFieldEditorDialog extends FieldEditorDialog {
Property property;
IntegerPropertyEditor limits;
IntegerFieldEditorDialog(EditTile parent, String title, Property property, IntegerPropertyEditor limits) {
super(parent, title);
this.property = property;
this.limits = limits;
this.ready();
}
@Override
protected String getValue() {
return "" + this.property.get();
}
@Override
protected boolean setValue(String text) {
if (text.length() != 0) {
try {
int val = Integer.parseInt(text);
if (!this.limits.rangeLimits || val >= this.limits.minVal && val <= this.limits.maxVal) {
this.parent.addUndoableSet(this.property, new Integer(val));
return true;
}
} catch (NumberFormatException var3) {
}
}
return false;
}
}
|