如何改变背景颜色的imageView在javafx



我有一个带有透明图像(PNG)的ImageView,因此图像不填充图像视图的完整矩形,当鼠标悬停在图像视图上时,我想改变图像视图矩形的背景颜色。在Css中我是怎么做的?图像视图节点是否具有- fix -background color属性?我试过了,但对我不起作用。我有一个css文件链接到。fxml

使用

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

By函数应该可以工作