... and, if necessary, remove the default Button. We added a ColorPicker control (with fx:id colorPicker), another Button and a Label (with fx:id levelLabel). For the two Buttons and the Label, we set their text as shown in Fig. 18.18.


A ColorPicker provides a predefined color-selecting GUI that, by default, enables the user to choose colors by color swatches (small squares of sample colors). Initially, the selected color is White. We’ll programmatically set this to Blue in the app’s controller. Figure 18.19 shows the ColorPicker’s default GUI and the Custom Colors GUI that appears when you click the ColorPicker’s Custom Color... link. The Custom Colors GUI enables you to select any custom color.

Event Handlers

When the user selects ...

Get Java How To Program, Late 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.