I have to create a javafx button with background image from some url. Image is showing perfectly. But the problem is image is not rounded. Image is showing as its original shape. But i need to create button as circular view with the image. How can i do this?
Here is the code i have tried
Image cameraIcon = new Image("//url");//image will be from url
ImageView cameraIconView = new ImageView(cameraIcon);
cameraIconView.setFitHeight(120);
cameraIconView.setFitWidth(120);
cameraIconView.setStyle(""
+ "-fx-border-color: black;"
+ "-fx-border-style: solid;"
+ "-fx-border-width: 10;"
+ "-fx-border-radius: 10 10 10 10;"
);
Button button;
button.setGraphic(cameraIconView);
button.setStyle("-fx-base: coral;");
button.setStyle(
"-fx-background-radius: 50em; "
+ "-fx-min-width: 60px; "
+ "-fx-min-height: 60px; "
+ "-fx-max-width: 130px; "
+ "-fx-max-height: 60px;"
);