use of maspack.util.StringHolder in project artisynth_core by artisynth.
the class ComponentPropertyField method setValueFromDisplay.
protected void setValueFromDisplay() {
if (myAlwaysParseText || !myLastText.equals(myTextField.getText()) || (myPropertySelector != null && !((String) (myPropertySelector.getValue())).equals(myLastPropName))) {
StringHolder errMsg = new StringHolder();
// we explicitly call fireValueCheckListeners instead of
// checkValue since textToValue may itself throw an error
// and we want to handle that in the same way
BooleanHolder corrected = new BooleanHolder();
Object value = textToValue(getText(), corrected, null);
if (value != Property.IllegalValue) {
value = validateValue(value, errMsg);
}
if (value == Property.IllegalValue) {
focusListenerMasked = true;
JOptionPane.showMessageDialog(this, errMsg.value, "Error", JOptionPane.ERROR_MESSAGE);
focusListenerMasked = false;
myTextField.setText(myLastText);
updateDisplay();
myLastEntryAccepted = false;
return;
}
updateValue(value);
updateDisplay();
} else {
setReverseTextBackground(false);
}
myLastEntryAccepted = true;
}
Aggregations