15. Node Variables and Events

Nodes are the core of the user interface in a JavaFX application. In the first part of this chapter, following on from the introduction in Chapter 14, “User Interface Basics,” we look at cursors and colors, which are features that are common to almost all node types. In the second part of this chapter, you see how to handle the events that are generated when the user interacts with the nodes in your application using either the keyboard or the mouse.

Unless otherwise specified, the example source code for this chapter can be found in the javafxnodes package of the JavaFX Book GUI project.

Cursors

When the mouse is over your application, its position is indicated by the mouse cursor. The shape of the default mouse ...

Get JavaFX™ Developer’s Guide 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.