Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to style a prompt text of combobox in java FX application?

I want to modify the css style of my combobox to reduce the text-size of its promptText.

How can this be done?

like image 667
Mehdi Boukhechba Avatar asked Oct 19 '25 10:10

Mehdi Boukhechba


1 Answers

If you only want to change size of the prompt text, and not the other text, I don't think there is any way: there's simply no hook into the text node for the prompt text that distinguishes it from the displayed text.

You can change the color via a special css property:

.combo-box .text-field {
    -fx-prompt-text-fill: rgba(255, 0, 0, 0.5) ;
}
.combo-box .text-field:focused {
    -fx-prompt-text-fill: transparent ;
}

but I don't see any way to change any other style properties.

like image 182
James_D Avatar answered Oct 21 '25 23:10

James_D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!