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 n
6 Years laters the bug is still there, here is a simpler way to go, specially if you won't want to mess with the other classes :
int indexOf = textField.getStyleClass().indexOf(INVALID_CLASS);
if(indexOf != -1){
textField.getStyleClass().remove(indexOf);
}
Why this works ? Because the list used for StyleClass which is a TrackableObservablieList inherits from a hierarchy where the remove(index) does fire changes where the remove(Object) does not.