CHAPTER 9

image

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 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.