I’m adding a style class to an node if it’s selected and then remove it if I select other item. Even if I remove the style class the style wont refresh so it wont go back to normal state:
admin_category_label.getStyleClass().remove(admin_category_label.getStyleClass().indexOf("selected"));
admin_category_label.getStyleClass().add("clear");
but the style will stay the same as class selected
This is a bug. It is reported here Removal of hovered style class, does not update styling. You may want to vote and watch it. As a workaround you should override css rules you touched/changed to be the same as default ones. Demo:
and the style.css is:
when the button is clicked the initially added
style1is removed and thestyle2is added.