With JavaFX, I would like to display a Label with a defined background color (when disabled, my Label's background becomes transparent), and I tried the code below, but that still doesn't work... Have you some tips for me? - Another thread told me to do a setEditable(false)
, but this approach isn't appropriated in my case.
FXML:
<Label styleClass="disable_backgrounded" layoutX="32.0" layoutY="23.0" prefHeight="25.0"
style="-fx-background-color: rgb(252,252,252);-fx-padding: 5px;" text="General" textFill="#aa0000">
<font>
<Font name="System Bold" size="14.0"/>
</font>
</Label>
CSS:
.disable_backgrounded:disabled {
-fx-background-color: rgb(252,252,252);
}