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
You can try to add a css for the application instead. You can use even FXML to separate de design from the logic of your application. Here is a piece of code that worked for me in JavaFX 2.1!
private Parent replaceSceneContent(String fxml) throws Exception {
Parent page = (Parent)
FXMLLoader.load(
Main.class.getResource(fxml), null, new JavaFXBuilderFactory());
Scene scene = stage.getScene();
if (scene == null) {
scene = new Scene(page, 1366, 720);
scene.getStylesheets().add(
Main.class.getResource(
"../skinFolder/css/defaultSkin.css" ).toExternalForm());
stage.setScene(scene);
} else {
stage.getScene().setRoot(page);
}
stage.sizeToScene();
return page;
}