0

Please, help me change color of validator this advice didn't help me :

.error * {
  -fx-text-fill: someColor;
}

and this just change color of prompt text:

-fx-prompt-text-fill: yourcolor;

Also, I treid this: (fxml)

<JFXTextField fx:id="usernameText" labelFloat="true" minWidth="220" promptText="%login.label" style="-fx-background-color: transparent;" styleClass="input">
    <validators>
        <RequiredFieldValidator message="Необходимо ввести имя пользователя" style="-fx-text-fill: red">
        </RequiredFieldValidator>
    </validators>
</JFXTextField>

or set styleClass="myClass" or through id="validator"; And describe class/id in my .css-file (i.css file hasn't problem)

Also I treid set style in my Controller (on groovy)

validator.setStyle("-fx-text-fill: red")

or

validator.getStyleClass().add("validator")

or

validator.setId("validator")

But all without success

My validator-code:

RequiredFieldValidator validator = new RequiredFieldValidator()   
usernameText.focusedProperty().addListener(new ChangeListener<Boolean>() {
    @Override
        void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (!newValue) {
                usernameText.validate()
            }
        }
    })
Calvin Nunes
  • 6,376
  • 4
  • 20
  • 48
Karina D.
  • 49
  • 1
  • 6

1 Answers1

3

I found the answer to my question

You can use the tool ScenicView in order to determine to which CSS-class the object belongs.

In my case this is

.error-label {
    -fx-text-fill: red;
    -fx-font-size: 8pt;
}

It's fix my problem

enter image description here

Karina D.
  • 49
  • 1
  • 6