Event target of mouse and drag-detected events

Pavel Safrata pavel.safrata at oracle.com
Fri May 24 04:32:06 PDT 2013


Hi Werner,
if you don't want to register handlers on the vbox children then yes, 
this looks like the best thing to do - the system cannot tell which node 
in the target's parent chain is your desired target, you need to decide 
that manually.

Alternatively, you can have a single handler using the event source and 
register it directly to the children.

Regards,
Pavel

On 24.5.2013 12:58, Werner Lehmann wrote:
> Hi,
>
> I am handling mouse and drag-detected events on a vbox to get a common 
> processing of the vbox children. Therefore event.source is always the 
> vbox (that is ok) but event.target is quite often some part of a skin, 
> e.g.
>
> com.sun.javafx.scene.control.skin.LabeledText
>
> To get to the actual label control I am currently checking the parent 
> chain to find a Skinnable parent node, or the vbox container. If a 
> Skinnable was found this is the "real target". If I get to the vbox 
> first, I assume that event.target is what I want to use here.
>
> This is not too complicated to do but I was wondering if this is the 
> best way?
>
> Werner



More information about the openjfx-dev mailing list