Chapter 5Using Colors and Gradients

Key Skills & Concepts

• Creating mixed colors

• Applying colors to shapes

• Using gradients

In this chapter you explore more deeply the powerful coloring and gradient tools available to you in JavaFX. In Chapter 4 you learned how to apply some basic, pre-created colors to shapes. In this chapter you learn how to mix your own colors, and you apply these colors to shapes and use them in gradients.

Using Color

The Color class is a very powerful class. In the last chapter you used a very small part of the Color class to fill a Line node with a solid color. You used just one or two of the 148 predefined colors of the Color class. This is a small sample of what the Color class is capable of.

The Color class can be ...

Get JavaFX A Beginners Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.