Styling specific objects using ID selectors

Addressing specific instances of the JavaFX classes can be done with the # symbol:

// CSS#myButton {    -fx-background-color: lightblue; }// JavaFXButton btn = new Button("hi");btn.setId("myButton");

Here, we style only one instance of the Button class, based on the value set in the setId method.

Get Mastering JavaFX 10 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.