From the course: Learning JavaFX GUI Development

Unlock the full course today

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

Create style rules

Create style rules

From the course: Learning JavaFX GUI Development

Start my 1-month free trial

Create style rules

- [Voiceover] When working with Cascading Style Sheets usually, they have more than one property that you want to group together as a new style. When you group these properties together, you create a style rule. Sometimes, styles need to be applied to multiple nodes. For example, maybe you want to set the font for all the text in the scene. There could be text on a button, there could be a text field, there could be text on a label. So, you might want to group them together so they all have the same font family and the same font size. It is also possible to have a style rule that has a pattern that is used to traverse the scene graph hierarchy of nodes. From the root node to the child nodes. For example, maybe we only want to style the buttons together that are inside of a horizontal box, but all other buttons might have a different rule. Let's take a look at some CSS style rules. I already have a program here that creates two buttons and both buttons have text. Let's take a look at…

Contents