Shapes and their properties
Everything you see on the screen of your computer can be split into three large categories:
- Shapes
- Text
- Images
Thus, by being able to create each of these, you can build any UI in reasonable time. Let's start with JavaFX shapes.
JavaFX shapes overview
The simplest object you can put on a scene is a shape. Under the javafx.scene.shape package
, the JavaFX API supports a great range of shapes, from circles and rectangles to polygons and SVG paths. Most shapes can be divided then into two categories—lines and closed shapes. The properties that are shared among all shapes will be covered in the next section. After, we will review each shape's specific APIs.
Closed shapes
There are just four options here—Rectangle, Circle, Ellipse, and Polygon. They mostly don't have any special API, just a minimum required by basic math to describe their form.
The only small difference is Rectangle, which can have rounded corners, controlled by the setArcHeight()
and setArcWidth()
methods....