use of com.fxexperience.javafx.scene.control.WebColorField in project fxexperience2 by EricCanull.
the class WebColorFieldSkin method updateText.
@Override
protected void updateText() {
Color color = ((WebColorField) control).getValue();
if (color == null)
color = Color.BLACK;
getTextField().setText(getWebColor(color));
}
use of com.fxexperience.javafx.scene.control.WebColorField in project fxexperience2 by EricCanull.
the class WebColorFieldSkin method updateValue.
@Override
protected void updateValue() {
Color value = ((WebColorField) control).getValue();
String text = getTextField().getText() == null ? "" : getTextField().getText().trim().toUpperCase();
if (text.matches("#[A-F0-9]{6}")) {
try {
Color newValue = Color.web(text);
if (!newValue.equals(value)) {
((WebColorField) control).setValue(newValue);
}
} catch (java.lang.IllegalArgumentException ex) {
System.out.println("Failed to parse [" + text + "]");
}
}
}
Aggregations