O'Reilly logo

JavaFX 1.2 Application Development Cookbook by Vladimir Vivien

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

Using CSS files to apply styles

As your application grows beyond a few GUI components, you will find it cumbersome and impractical to use inline CSS directives to apply styles. Similar to HTML documents, the JavaFX platform provides the necessary mechanism to externalize style declarations in one or more CSS files. In this recipes we will explore how to create and attach a CSS file to your applications.

Getting ready

Before you go through this recipe, you should have an idea of what CSS is and how it is used. Review the previous recipe Styling your applications with CSS to get an idea of how JavaFX CSS works. You will create a simple application and an accompanying stylesheet file. We will examine how the elements are styled using the declared ...

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