May 2018
Intermediate to advanced
268 pages
6h 43m
English
Currently, only colors can be defined in constants. They are called looked-up-colors in the spec:
* { my-color: #eee }.button { -fx-background-color: my-color}
This way, you can define a palette for the whole app in one place and easily adjust it.
Another way to reuse styles defined elsewhere is by using the inherit keyword. It allows for nested elements to reuse styles defined in parent ones:
/* chapter6/syntax/inherit-demo.css */.root { -fx-padding: 10px; -fx-background-color: white;}.radio-button { -fx-font-size: 30 }.radio-button:selected > * { -fx-background-color: inherit; }
In this example, our radio button will inherit its background color from the parent if selected. This produces ...
Read now
Unlock full access