2D Shapes(Objects) Properties - Stroke Type



This property is of the type StrokeType. It represents the position of the boundary line applied to the shape. You can set the type of the stroke using the method setStrokeType() as follows −

Path.setStrokeType(StrokeType.CENTERED);

The stroke type of a shape can be −

  • Inside − The boundary line will be drawn inside the edge (outline) of the shape (StrokeType.INSIDE).

  • Outside − The boundary line will be drawn outside the edge (outline) of the shape (StrokeType.OUTSIDE).

  • Centered − The boundary line will be drawn in such a way that the edge (outline) of the shape passes exactly thorough the center of the line (StrokeType.CENTERED).

By default, the stroke type of a shape is centered. Following is the diagram of a triangle with different Stroke Types −

Stroke Type
javafx_2d_shapes.htm
Advertisements