Is it possible to bind CSS files to style JavaFX components and also change properties dynamically in code? I'm struggling with the setStyle() method as there's limited documentation available on how to use it effectively.
Instead of modifying the .css file, I'd like to change the hover color directly from the setStyle() method. Here's an example of the existing .css file:
.list-cell:filled:hover
{
-fx-background-color: #0093ff;
-fx-text-fill: white;
}
I attempted to change the hover color dynamically using the setStyle() method like this:
noteListView.setStyle(
":filled:hover{" +
"-fx-background-color: #65ffb0;" +
"-fx-text-fill: white;" +
"}");
Unfortunately, this approach didn't work. Any guidance would be greatly appreciated. Thank you.