Search in sources :

Example 1 with DoubleValidator

use of com.jfoenix.validation.DoubleValidator in project JFoenix by jfoenixadmin.

the class DoubleTextFieldEditorBuilder method createNode.

@Override
public Region createNode(Double value, DoubleBinding minWidthBinding, EventHandler<KeyEvent> keyEventsHandler, ChangeListener<Boolean> focusChangeListener) {
    StackPane pane = new StackPane();
    pane.setStyle("-fx-padding:-10 0 -10 0");
    textField = new JFXTextField(value + "");
    textField.minWidthProperty().bind(minWidthBinding);
    textField.setOnKeyPressed(keyEventsHandler);
    textField.focusedProperty().addListener(focusChangeListener);
    DoubleValidator validator = new DoubleValidator();
    validator.setMessage("Value must be a rational number");
    textField.getValidators().add(validator);
    pane.getChildren().add(textField);
    return pane;
}
Also used : DoubleValidator(com.jfoenix.validation.DoubleValidator) JFXTextField(com.jfoenix.controls.JFXTextField) StackPane(javafx.scene.layout.StackPane)

Aggregations

JFXTextField (com.jfoenix.controls.JFXTextField)1 DoubleValidator (com.jfoenix.validation.DoubleValidator)1 StackPane (javafx.scene.layout.StackPane)1