user13632019
user13632019

Reputation:

Is there any way to change combo box arrow button color in javafx?

enter image description here

I want to be able to change the combo box arrow button color not background color but the color of the button only to the color of the border and text fill both of which are set to #f0f0f0.

Is It possible, if so then how?

Upvotes: 0

Views: 1076

Answers (1)

b3tuning
b3tuning

Reputation: 347

Using css selectors you can change the arrow, and arrow button color however you want

.combo-box .arrow {
    -fx-background-color: black;
}

.combo-box .arrow-button {
    -fx-background-color: white;
    -fx-size: 5;
}

to do this in code without editing the .css file, assuming your ComboBox is named comboBox

comboBox.lookup(".arrow").setStyle("-fx-background-color: black;");
comboBox.lookup(".arrow-button").setStyle("-fx-background-color: white;");

Upvotes: 1

Related Questions