0

I would like to set an Image as Button, but getting always the following Error:

Bound mismatch: The type MouseEvent is not a valid substitute for the bounded parameter of the type EventHandler

@FXML ImageView imgReturn;

    public void initialize(URL arg0, ResourceBundle arg1) {

    imgReturn.setOnMouseClicked(new EventHandler<MouseEvent>()
                @Override
                public void handle(MouseEvent ev)
                {

                }
    );
  • 1
    See also: [JavaFX - create custom button with image](http://stackoverflow.com/questions/10518458/javafx-create-custom-button-with-image) – jewelsea Feb 09 '15 at 18:26

1 Answers1

0

Just check your imports.

You are using a wrong MouseEvent:

import java.awt.event.MouseEvent;

You should use the JavaFX one instead:

import javafx.scene.input.MouseEvent;
José Pereda
  • 44,311
  • 7
  • 104
  • 132