Limit double model set value to max and min
This commit is contained in:
parent
e9eec0454b
commit
ea2173b92c
@ -774,6 +774,14 @@ public class DoubleModel implements StateChangeListener, ChangeSource, Invalidat
|
|||||||
public void setValue(double v) {
|
public void setValue(double v) {
|
||||||
checkState(true);
|
checkState(true);
|
||||||
|
|
||||||
|
if (v > maxValue) {
|
||||||
|
log.debug("Clipping value " + v + " to maximum " + maxValue + " for " + this);
|
||||||
|
v = maxValue;
|
||||||
|
} else if (v < minValue) {
|
||||||
|
log.debug("Clipping value " + v + " to minimum " + minValue + " for " + this);
|
||||||
|
v = minValue;
|
||||||
|
}
|
||||||
|
|
||||||
log.debug("Setting value " + v + " for " + this);
|
log.debug("Setting value " + v + " for " + this);
|
||||||
if (setMethod == null) {
|
if (setMethod == null) {
|
||||||
if (getMethod != null) {
|
if (getMethod != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user