I am working with java fxml application and i have one hyperlink, I want to change its color when mouse is over it and again revert back when mouse is exited from it. Can any body post some code to achieve it. I tried some css code but not working,
On mouse entered:-
@FXML
private void changeCloseColorToWhite() {
hypLnkClose.setStyle("-fx-color: white;");
}
On mouse exited:-
@FXML
private void changeCloseColorToBrown() {
hypLnkClose.setStyle("-fx-color: #606060;");
}
Thanks in advance.
Setting style in java code is heavy on the application. I would suggest defining this in the CSS file. try something like this below to fulfill what you need:
.hyperlink:hover {
-fx-underline: true;
}