8803286
8803286

Reputation: 81

How to edit textfield selected text color in JavaFX?

Ive searched everywhere and could not find the thing i wanted so i ask u guys if u could help me with this.

I want the blue selected text to be red

Image-> https://www.dropbox.com/s/2wv8b6ar6qs7dbz/image.png?dl=0

I'm using java fxml in a .css file

This is the only thing i have for the textfield css

.text-field {
    -fx-border-color: #1c1c1c;
    -fx-border-style: solid;
    -fx-border-radius: 1px;
    -fx-text-fill: #888;
    -fx-background-color: #353535;
}

Upvotes: 1

Views: 4028

Answers (1)

James_D
James_D

Reputation: 209225

The highlight color in the default stylesheet (modena.css) is represented as a looked-up color called -fx-accent. So you can do

.text-field {
    -fx-accent: red ;
}

Upvotes: 4

Related Questions