On Wed, 5 Aug 2026 12:53:29 GMT, Nir Lisker <[email protected]> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/input/MouseEvent.java
>> line 141:
>>
>>> 139: /// distinguish between these two cases, the event target can be
>>> tested on equality with the node.
>>> 140: ///
>>> 141: /// Since `MOUSE_ENTERED`/`MOUSE_EXITED` are subtypes of
>>> `MOUSE_ENTERED_TARGET`/`MOUSE_EXITED_TARGET`, they are also
>>
>> the "subtype" thing is present in the original doc and is quite confusing:
>> aren't those distinct types?
>> maybe instead we should just rephrase the whole thing saying the *TARGET
>> events are delivered to parents while the ENTERED/EXITED ones to the target
>> node only?
>>
>> the original phrase "It's still one event just switching types" actually
>> explains the whole thing better.
>
>> the "subtype" thing is present in the original doc and is quite confusing:
>> aren't those distinct types?
>
> All the events are distinct from a proper Java language perspective (no
> `extends`), but they hold information about their "event supertype":
>
> EventType<MouseEvent> MOUSE_ENTERED_TARGET = new EventType<>(MouseEvent.ANY,
> "MOUSE_ENTERED_TARGET");
> EventType<MouseEvent> MOUSE_ENTERED = new
> EventType<>(MouseEvent.MOUSE_ENTERED_TARGET, "MOUSE_ENTERED");
>
> The first argument is `superType`, so `MOUSE_ENTERED` is a subtype of
> `MOUSE_ENTERED_TARGET` in the event system. Don't get me started on what I
> think about this design :)
now I see it, thanks!
I wonder if we could link to the `EventType(EventType)` constructor when we
talk about subtypes, something like this:
`are {@link EventType#EventType(EventType) subtypes} of`
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2238#discussion_r3732237261