Search in sources :

Example 6 with TextInputControl

use of javafx.scene.control.TextInputControl in project JFoenix by jfoenixadmin.

the class NumberValidator method evalTextInputField.

private void evalTextInputField() {
    TextInputControl textField = (TextInputControl) srcControl.get();
    String text = textField.getText();
    try {
        hasErrors.set(false);
        if (!text.isEmpty())
            numberStringConverter.fromString(text);
    } catch (Exception e) {
        hasErrors.set(true);
    }
}
Also used : TextInputControl(javafx.scene.control.TextInputControl) ParseException(java.text.ParseException)

Example 7 with TextInputControl

use of javafx.scene.control.TextInputControl in project JFoenix by jfoenixadmin.

the class RegexValidator method evalTextInputField.

private void evalTextInputField() {
    TextInputControl textField = (TextInputControl) srcControl.get();
    // Treat null like empty string
    String text = (textField.getText() == null) ? "" : textField.getText();
    if (regexPatternCompiled.matcher(text).matches()) {
        hasErrors.set(false);
    } else {
        hasErrors.set(true);
    }
}
Also used : TextInputControl(javafx.scene.control.TextInputControl)

Aggregations

TextInputControl (javafx.scene.control.TextInputControl)7 TextField (javafx.scene.control.TextField)2 ParseException (java.text.ParseException)1 LocalDate (java.time.LocalDate)1 Date (java.util.Date)1 CheckBox (javafx.scene.control.CheckBox)1 Control (javafx.scene.control.Control)1 DatePicker (javafx.scene.control.DatePicker)1 TextArea (javafx.scene.control.TextArea)1