Search code examples
javajavafxstylesjfoenix

JFXButton Rippler Fill Color Can't Be Change


I have a problem with styling JFXButton from this library : jfoenix.com

I would like to change the JFXButton Rippler Fill Color, when user click a button. But it's not working. I checked on the internet. But a solution could not be found. Have you to any ideas?

@FXML
private void settingApplyBtnAction(ActionEvent event) {

 //option 1
 paymentBtn.setStyle("-jfx-rippler-fill: " + themeColor);
 //option 2
 paymentBtn.setStyle("-fx-rippler-fill: " + themeColor);

 /*other code....*/

}

But if I give a color from SceneBuilder, it's working fine. Anyone can help me.


Solution

  • If you must use code to change your theme, try using the setRipplerFill method on the JFXButton class.

    @FXML
    private void settingApplyBtnAction(ActionEvent event) {
    
        paymentBtn.setRipplerFill(Color.valueOf(themeColor));
    
        /*other code....*/
    
    }