How to change the color of text in javafx TextField?

javafx

Solution

Setting the `-fx-text-fill` works for me.

See below:

if (passed) {
    resultInfo.setText("Passed!");
    resultInfo.setStyle("-fx-text-fill: green; -fx-font-size: 16px;");
} else {
    resultInfo.setText("Failed!");
    resultInfo.setStyle("-fx-text-fill: red; -fx-font-size: 16px;");
}

Problem

I want to change font color in TextField .I found `-fx-background-color` , `-fx-border-color` for changing the color of background and border but nothing for text.

Original source

Related problems