我曾尝试做一个老鼠的事件在我的系统项目,该项目是当老鼠进入的背景的颜色会变化和当鼠退出会给空,但这个错误只是保持未来:
The method setBackground(Background) in the type Region is not applicable for the arguments (Color)
该方法在我的控制器类:
public void barcolor(MouseEvent event) {
menubar.addEventHandler(MouseEvent.MOUSE_ENTERED, e ->
menubar.setBackground(Color.WHITE)
);
menubar.addEventHandler(MouseEvent.MOUSE_EXITED, e ->
menubar.setBackground(null)
);
}