... fx:id :

  1. Select the Canvas, then expand the Scene Builder Inspector ’s Code section by clicking the right arrow (Clicking the right arrow.) next to Code.

  2. For the fx:id property, type canvas and press Enter.

Specifying the Button’s Event-Handler Method

An event handler is a method that’s called in response to a user interaction, such as when the user clicks this app’s Draw Lines Button. The method is called by the JavaFX runtime on an object of the controller class. To specify the Button event handler’s name:

  1. Click the Button to select it.

  2. For the On Action property in the Inspector ’s Code section, type the method name drawLinesButtonPressed and press Enter.

Get Java How to Program, Early Objects, 11th Edition 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.