O'Reilly logo

NetBeans IDE 8 Cookbook by Rhawi Dantas, David Salter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Styling a JavaFX application with CSS

One of the benefits of JavaFX applications is that their user interfaces can be designed rather than developed. This is typically a job done by a designer rather than a developer. As such, it's a good practice to place all of the application styling outside of Java code within a CSS file.

It's possible to style a JavaFX application within Java code by setting fonts and colors and layout padding (we saw an example of setting padding on elements within the Creating a JavaFX application recipe) within the Java code, but obviously, this makes it more difficult to make style changes to an application.

In this recipe, we'll see how we can apply CSS changes primarily to FXML files. We'll also show how CSS can be applied ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required