ฉันพยายามทำเป็นเมาส์เหตุการณ์ในของฉัน JavaFX โครงการซึ่งเป็นเมื่อเมาส์เข้ามาในสีพื้นหลังจะเปลี่ยนแปลงและเมื่อตัวชี้ของเมาส์มาอยู่เหออกจากจะให้โพรโทคอล aimcomment แต่ข้อผิดพลาดนี้แค่เรียกเก็บเงินเข้ามาเรื่อ:
The method setBackground(Background) in the type Region is not applicable for the arguments (Color)
จากวิธีการขอ controller นักเรียน:
public void barcolor(MouseEvent event) {
menubar.addEventHandler(MouseEvent.MOUSE_ENTERED, e ->
menubar.setBackground(Color.WHITE)
);
menubar.addEventHandler(MouseEvent.MOUSE_EXITED, e ->
menubar.setBackground(null)
);
}