zennon
zennon

Reputation: 1090

JavaFX choicebox text color

Iam trying to change the TextColor of an ChoiceBox in JavaFX.

This is my css file:

.choice-box{
      -fx-background-color: 
        #000000,
        linear-gradient(#7ebcea, #2f4b8f),
        linear-gradient(#426ab7, #263e75),
        linear-gradient(#395cab, #223768);
    -fx-padding: 3 10 4 20;
    -fx-text-fill: white;
    -fx-font-size: 12px;
}

And this is a screenshot of my choice-box:

enter image description here

-fx-text-fill: white; works on buttons but not on choic boxes. Why?

How can i change the color of the text in the choicebox?

Upvotes: 3

Views: 8528

Answers (2)

tonimaroni
tonimaroni

Reputation: 1093

i think you can do:

.choice-box .label {
     -fx-text-fill: white; 
}

Upvotes: 7

Aakash
Aakash

Reputation: 1900

You should give these properties to the listcell and not the choice-box. Refer this : http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#labeled

Hope it helps

Upvotes: 1

Related Questions