Event Handling

In this chapter, you will learn:

  • What an event is
  • What an event source, an event target, and event type are
  • About the event processing mechanism
  • How to handle events using event filters and event handlers
  • How to handle mouse events, key events, and window events

What Is an Event?

In general, the term event is used to describe an occurrence of interest. In a GUI application, an event is an occurrence of a user interaction with the application. Clicking the mouse and pressing a key on the keyboard are examples of events in a JavaFX application.

An event in JavaFX is represented by an object of the javafx.event.Event class ...

Get Learn JavaFX 8: Building User Experience and Interfaces with Java 8 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.