Understanding naming convention for style classes and properties

All JavaFX classes are mapped to CSS ones by converting their camel-case names to all lowercase letters with hyphens as word separators.

For example, GridPane will be called grid-pane in CSS and you can style all GridPane objects by adjusting the corresponding style class:

.grid-pane {    -fx-background-color: lightblue;     -fx-padding: 10px;}

This hyphen approach works for properties as well. For example, knowing there is a property named minWidth, you can see that the corresponding CSS style property will be named -fx-min-width.

There is also a special .root style class which refers to any layout manager used in Scene.setRoot().

Also, you can introduce your own style classes and ...

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.