Java Code Examples for javafx.scene.control.TextInputControl#getText()

The following examples show how to use javafx.scene.control.TextInputControl#getText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PasswordValidator.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void evalTextInputField() {
    TextInputControl textField = (TextInputControl) srcControl.get();
    String text = textField.getText();
    hasErrors.set(false);

    if (!passwordsMatch) {
        hasErrors.set(true);
        message.set(Res.get("password.passwordsDoNotMatch"));
    } else if (text.length() < 8) {
        hasErrors.set(true);
        message.set(Res.get("validation.passwordTooShort"));
    } else if (text.length() > 50) {
        hasErrors.set(true);
        message.set(Res.get("validation.passwordTooLong"));
    }
}
 
Example 2
Source File: AutocompleteMenu.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private void lookup(final TextInputControl field)
{
    final String text = field.getText();

    synchronized (results)
    {
        results.clear();
    }
    proposal_service.lookup(text, (name, priority, proposals) -> handleLookupResult(field, text, name, priority, proposals));
}
 
Example 3
Source File: IntegerValidator.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void evalTextInputField() {
    TextInputControl textField = (TextInputControl) srcControl.get();
    String text = textField.getText();
    try {
        hasErrors.set(false);
        if (!text.isEmpty()) {
            Integer.parseInt(text);
        }
    } catch (Exception e) {
        hasErrors.set(true);
    }
}
 
Example 4
Source File: RequiredFieldValidator.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void evalTextInputField() {
    TextInputControl textField = (TextInputControl) srcControl.get();
    if (textField.getText() == null || textField.getText().isEmpty()) {
        hasErrors.set(true);
    } else {
        hasErrors.set(false);
    }
}
 
Example 5
Source File: StringLengthValidator.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void evalTextInputField() {
    TextInputControl textField = (TextInputControl) srcControl.get();
    String text = textField.getText();
    hasErrors.set(false);

    if (!text.isEmpty()) {
        if (text.length() > StringLength - 1) {
            hasErrors.set(true);
            //  textField.textProperty().set(text.substring(0, 19));

        }
    }
}
 
Example 6
Source File: RegexValidator.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void evalTextInputField() {
    TextInputControl textField = (TextInputControl) srcControl.get();
    String text = (textField.getText() == null) ? "" : textField.getText(); // Treat null like empty string

    if (regexPatternCompiled.matcher(text).matches()) {
        hasErrors.set(false);
    } else {
        hasErrors.set(true);
    }
}
 
Example 7
Source File: NumberValidator.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 8
Source File: JFXChipViewSkin.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
private double computeTextContentWidth(TextInputControl editor) {
    Text text = new Text(editor.getText());
    text.setFont(editor.getFont());
    text.applyCss();
    return text.getLayoutBounds().getWidth();
}