2

I have a ImageView with a transparent image (PNG) therefore the image doesn't fill the complete rectangle of the image view, when mouse hover over the image view I want to change the background color of only the rectangle of the image view. In Css how I do it? do the image view node have the property -fx-background color? I tried and it's doesn't work for me. I have a css file linked to the .FXML

Sredny M Casanova
  • 4,735
  • 21
  • 70
  • 115

1 Answers1

0

Use this

Bounds bound = ImageView.getBoundsInLocal(); //getting co-ordinates
ImageView.setEffect(ColorInput(bound.getMinX(), bound.getMinY(),
            bound.getWidth(), bound.getHeight(), Color.YELLOW));

By function should work.

Elltz
  • 10,730
  • 4
  • 31
  • 59