22.2 Controlling Fonts with Cascading Style Sheets (CSS)

In Chapters 1213, you built JavaFX GUIs using Scene Builder. You specified a particular JavaFX object’s appearance by selecting the object in Scene Builder, then setting its property values in the Properties inspector. With this approach, if you want to change the GUI’s appearance, you must edit each object. If you have a large GUI in which you want to make the same changes to multiple objects, this can be time consuming and error prone.

In this chapter, we format JavaFX objects using a technology called Cascading Style Sheets (CSS) that’s typically used to style the elements in web pages. CSS allows you to specify presentation (e.g., fonts, spacing, sizes, colors, positioning) separately ...

Get Java How to Program, Early Objects, 11th Edition 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.