© Ralph Lecessi 2019
Ralph LecessiFunctional Interfaces in Javahttps://doi.org/10.1007/978-1-4842-4278-0_15

15. Use in JavaFX Applications

Ralph Lecessi1 
(1)
Kendall Park, NJ, USA
 

In Java 11, JavaFX was removed from the JDK and has been made available as a separate module. In order to run these examples in Java 11, the JavaFX SDK must be installed and added to the module path. The classes and methods have been available since JavaFX 2.0.

Section 15.1: Handling JavaFX Events

JavaFX provides the EventHandler functional interface to handle events. It has functional method handle which accepts an Event.
@FunctionalInterface
public interface EventHandler<T extends Event> extends EventListener
{
   void handle(T event);
}
The following example implements a handler ...

Get Functional Interfaces in Java: Fundamentals and Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.