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 the css background color from my stylesheet by doing:
myButton.setStyle("fx-background-color: #FFF");
The latter fails do change the color though. Could it be that once ive set my stylesheet that I cant override it? How can I change the button color on click?
I had to do a similar thing(here is simplified, there is just the part of code which change the style to the button) and i did this, i hope it will be helpful to you
CSS: