JFXButton Rippler Fill Color Can't Be Change

1.2k Views Asked by At

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.

1

There are 1 best solutions below

2
On BEST ANSWER

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....*/

}