EventHandler not working in 11.0.2
Michael Hall
mik3hall at gmail.com
Sat Mar 30 14:37:16 UTC 2019
> On Mar 27, 2019, at 1:29 PM, Andrew Munn <andrew at nmedia.net> wrote:
>
> How do I listen for mouse events in 11.0.2? IntelliJ's code completion
> suggests this:
>
> textField.addEventHandler(MouseEvent.MOUSE_ENTERED, (EventHandler<T>) t -> {
> // do something
> });
>
> but it fails to compile with error: cannot find symbol T
>
> Thanks
Isn’t that just generic notation saying it takes an event handler where you indicate the specific type.
e.g. this https://docs.oracle.com/javafx/2/events/handlers.htm <https://docs.oracle.com/javafx/2/events/handlers.htm> includes
node.addEventHandler(DragEvent.DRAG_ENTERED,
new EventHandler<DragEvent>() {
public void handle(DragEvent) { ... };
});
showing that this handler is for DragEvent’s, specifically the DRAG_ENTERED event in this case.
So you need to pass your own handler as that parameter.
More information about the openjfx-dev
mailing list