[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: EventHandler not working in 11.0.2
From:       Michael Hall <mik3hall () gmail ! com>
Date:       2019-03-30 14:37:16
Message-ID: 1E6FF073-9A8F-4AF3-8E87-C5B3D742B919 () gmail ! com
[Download RAW message or body]



> On Mar 27, 2019, at 1:29 PM, Andrew Munn <andrew@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. 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic