Java Reference
In-Depth Information
font-family:"Arial Black";
.specialText {
font-family:"Arial Black";
.broad {
When the code for this application is executed (given that the CSS file is located in the same
directory as the JavaFX source file), you will get the result shown in the next screenshot:
How it works...
The beauty of styling with CSS becomes apparent when you define your styles in a CSS
file and reuse your styles throughout your application. In this recipe, we created a simple
application which uses styles declared in a separate file.
Let's explore the JavaFX code first. Reviewing the code, you can see that the shapes used in
the application have little or no style properties defined in the code. However, as seen in the
previous screenshot, they have plenty of visual properties applied. This is how:
F Circle—the Circle shape receives its styles due to the Circle{} type selector defined
in the CSS file. The definition of the type selector Circle{} causes any Circle type
defined in the code to be styled using that selector.
Search WWH ::

Custom Search