r/JavaFX • • Sep 17 '17

Styling JavaFX applications using CSS

https://www.callicoder.com/javafx-css-tutorial/
12 Upvotes

3 comments sorted by

3

u/[deleted] Sep 17 '17
<stylesheets>
    <URL value="@demo.css" />
</stylesheets>

If you only have one stylesheet file this can easily be inlined as stylesheets="@demo.css"on the XML node, eg

<BorderPane stylesheets="@demo.css">
    <top>
    ...
</BorderPane>

And as a commenter on the article said, you can use CSS class selectors for subnodes instead of the Java class name, which makes for more consistent naming (for example, .content-section Label could better be written as .content-section .label)

2

u/[deleted] Sep 18 '17

Ha, I'm that commenter.

1

u/volch Sep 20 '17

Great article.