I know I can set a color by using the pressed pseudo selector:
myButton:pressed{}
Problem is, im trying to do this in code by overriding th
Styling FX Buttons with CSS show some applicable style options for a button.
"fx-background-color" is just a typo. It needs to be "-fx-background-color".
To use the styles you need to get the style names and values correct and separate them with semicola. The following approach does this systematically:
String bstyle=String.format("-fx-text-fill: %s;-fx-fill: %s;-fx-background-color: %s;",textFill,fill, bgColor);
button.setStyle(bstyle);