From the course: Learning JavaFX GUI Development

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Add CSS to style a form

Add CSS to style a form

From the course: Learning JavaFX GUI Development

Start my 1-month free trial

Add CSS to style a form

- (Voiceover) CSS stands for Cascading Style Sheets, and it's been used for some time to add a look and feel to HTML pages that separates the styling from the content. Understanding CSS is not in the scope of this course, but if you're not familiar with CSS, take some time to check out CSS Fundamentals by James Williamson. By adding the style using CSS, it allows us to defer the styling while the development of the application is done. So you can make sure your app works and then apply styling later in the process. This also makes changing the look and feel easier if needed at a later date. All CSS files are easily identifiable by the .css extension. The JavaFX framework applies some default styles to the components, but here we will add some new styles to the login program. For this example, I'm going to add a background image and style the text, labels and buttons using CSS. Let's switch over to NetBeans. Here, I have my Login.java program open. Since I want to add a background…

Contents