CHAPTER 17

image

Understanding 2D Shapes

In this chapter, you will learn:

  • What 2D shapes are and how they are represented in JavaFX
  • How to draw 2D shapes
  • How to draw complex shapes using the Path class
  • How to draw shapes using the Scalable Vector Graphics (SVG)
  • How to combine shapes to build another shape
  • How to use strokes for a shape
  • How to style shapes using Cascading Style Sheets (CSS)

What Are 2D Shapes?

Any shape that can be drawn in a two-dimensional plane is called a 2D shape. JavaFX offers variety nodes to draw different types of shapes (lines, circles, rectangles, etc.). You can add shapes to a scene graph.

Shapes can be two-dimensional or ...

Get Learn JavaFX 8: Building User Experience and Interfaces with Java 8 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.