JavaFX 2D Shapes Arc - JavaFX

What is JavaFX 2D Shapes Arc?

An arc is part of a curve. It is described by the following properties −

  • length − The distance along the arc.
  • angle − The angle the curve makes at the centre of the circle.
  • radiusX − The width of the full Ellipse of which the current arc is a part of.
  • radiusY − The height of the full Ellipse of which the current arc is a part of.

JavaFX - 2D Shapes Arc


In JavaFX, an arc is represented by means of a class named Arc. This class belongs to the package javafx.scene.shape.

Through instantiating this class, you can create an arc node in JavaFX.

This class has some properties of the double datatype particularly –

  • centerX − The x coordinate of the center of the arc.
  • centerY − The y coordinate of the center of the arc.
  • radiusX − The width of the full ellipse of which the current arc is a part of.
  • radiusY − The height of the full ellipse of which the current arc is a part of.
  • startAngle − The starting angle of the arc in stage.
  • length − The angular extent of the arc in stage.

To draw an arc, you want to pass values to these properties, either by way of passing them to the constructor of this class, in the equal order, on the time of instantiation, as shown below –

Or, by using their respective setter methods as follows −

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JavaFX Topics