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.

Solution: Create a CSS file with styles

Solution: Create a CSS file with styles

From the course: Learning JavaFX GUI Development

Start my 1-month free trial

Solution: Create a CSS file with styles

(bright music) - [Voiceover] : Here's the code that was in the exercise files folder and you can see that I'm using separate methods to try and reduce the amount of code in the start method. So I have a border pane and then I add an H box to the border pane using a method. If I scroll down a little bit, starting on line 46 is the start of the method that creates three buttons. I changed their size to be 100 by 20 and then I add them to my H box. I attach a style class called H box. Next, if I scroll down a little further. I add the two labels to the left-hand margin. I'm also adding a style class to these as well called V box. And finally, we have our pie chart. The pie chart method simply creates the pie chart and returns it to the calling program. Let me scroll back up to the start method. Let's run the program the way it is so we can see what it looks like without any styles. It's not bad but the buttons on the top look awful smushed and don't have any color to them. The labels the…

Contents