javafx-2 getStyleClass().removeAll

Dieselrat

New Member
I just started out playing around with CSS in javafx 2. I have some issues with removing CSS style classes from a Pane. The Pane gets a background color and border based on a boolean value of a custom object:\[code\]//kw is a subobject of objects in a listview, everytime the selection is changed //the CSS on the pane gets refreshedresetGUI();...if(kw != null){ if (kw.getAfgewerkt()) { pRA.getStyleClass().add("success"); //true } else { pRA.getStyleClass().add("error"); //false }}...\[/code\]The above works.However before I set the style classes on the pRA Node, I reset the CSS by calling resetGUI() method because when the kw object is null, no CSS should be applied.\[code\]public void resetGUI(){ ... pRA.getStyleClass().removeAll("error", "success"); ...}\[/code\]It seems that the removing of the StyleClasses does not work. I want the pRa node to look as 'default' if the kw object is null. Do I have to create a 'default' class myself in the CSS file? That shouldn't be the case I assume?This is the css:\[code\].error {-fx-background-color: #FBE3E4;-fx-text-fill:#8a1f11;-fx-border-style:solid;-fx-border-color:#FBC2C4;}.success {-fx-background-color:#E6EFC2;-fx-text-fill:#264409;-fx-border-style:solid;-fx-border-color:#C6D880;}\[/code\]
 
Back
Top