Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8306021 Add event handler management to EventTarget
  3. JDK-8310445

Release Note: Event Handler Methods Added to EventTarget Interface

    XMLWordPrintable

Details

    Description

      Four new default methods were added to the `javafx.event.EventTarget` interface:

      ```
      <E extends Event> void addEventHandler(EventType<E>, EventHandler<? super E>)
      <E extends Event> void removeEventHandler(EventType<E>, EventHandler<? super E>)
      <E extends Event> void addEventFilter(EventType<E>, EventHandler<? super E>)
      <E extends Event> void removeEventFilter(EventType<E>, EventHandler<? super E>)
      ```

      This change allows applications to manage event handlers for all `EventTarget` implementations.

      Most applications will not run into any backward compatibility problems with this change. The change is fully binary compatible and, for most use cases, it is also source compatible.

      A compilation error will occur in one of the following two unlikely cases:

      * An application class extends `Menu`, `MenuItem`, `TableColumnBase`, or `TreeItem`, and overrides `addEventHandler` or `removeEventHandler`
      * An application class that is not a subclass of `Node` implements their own `addEventHandler` or `removeEventHandler` using a signature other than that of the newly added methods (for example, copying the same incorrect pattern that `MenuItem` used prior to this release)

      In these cases, the declared methods must be changed to conform to the updated interface method signature.

      Attachments

        Activity

          People

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: