How to make an animation with CSS in JavaFX?
问题 I want to change the style of Node by changing its style class. Button button = new Button(); button.getStyleClass().add("class1") button.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { button.getStyleClass().add("class2"); } }); Is it possible to change the style gradually, for making something like a transition? 回答1: Is it possible to change style gradually, for example make some transition? Yes. You will need to use setStyle rather