APIdia Launch Partner
Top Description Fields Constructors Methods
javafx.scene.shape

public non-sealed Class Polygon

extends Shape
Class Inheritance
Imports
com.sun.javafx.collections.TrackableObservableList, com.sun.javafx.geom.BaseBounds, .Path2D, com.sun.javafx.geom.transform.BaseTransform, com.sun.javafx.scene.DirtyBits, .NodeHelper, com.sun.javafx.scene.shape.PolygonHelper, .ShapeHelper, com.sun.javafx.sg.prism.NGNode, .NGPolygon, .NGShape, javafx.collections.ListChangeListener.Change, .ObservableList, javafx.scene.Node, javafx.scene.paint.Paint

Creates a polygon, defined by an array of x,y coordinates. The Polygon class is similar to the Polyline class, except that the Polyline class is not automatically closed.
import javafx.scene.shape.*;

Polygon polygon = new Polygon();
polygon.getPoints().addAll(new Double[]{
    0.0, 0.0,
    20.0, 10.0,
    10.0, 20.0 });
Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private final ObservableList<Double>
points

Defines the coordinates of the polygon vertices.

private final Path2D
Inherited from javafx.scene.shape.Shape:
old_fillold_stroke

Constructor Summary

AccessConstructor and Description
public
Polygon()

Creates an empty instance of Polygon.

public
Polygon(double...
the coordinates of the polygon vertices
points
)

Creates a new instance of Polygon.

Method Summary

Modifier and TypeMethod and Description
private BaseBounds
private Path2D
private NGNode
private void
public final ObservableList<Double>

Returns:

An observable list of vertices of this Polygon
getPoints
()

Gets the coordinates of the Polygon vertices.

public String

Returns:

a string representation of this Polygon object.
toString
()

Overrides javafx.scene.Node.toString.

Returns a string representation of this Polygon object.

Inherited from javafx.scene.shape.Shape:
computeBoundscomputeShapeBoundscomputeShapeContainsconvertLineJoinfillPropertygetClassCssMetaDatagetCssMetaDatagetFillgetModegetStrokegetStrokeDashArraygetStrokeDashOffsetgetStrokeLineCapgetStrokeLineJoingetStrokeMiterLimitgetStrokeTypegetStrokeWidthintersectisSmoothsetFillsetShapeChangeListenersetSmoothsetStrokesetStrokeDashOffsetsetStrokeLineCapsetStrokeLineJoinsetStrokeMiterLimitsetStrokeTypesetStrokeWidthsmoothPropertystrokeDashOffsetPropertystrokeLineCapPropertystrokeLineJoinPropertystrokeMiterLimitPropertystrokePropertystrokeTypePropertystrokeWidthPropertysubtractunion

Field Detail

pointsback to summary
private final ObservableList<Double> points

Defines the coordinates of the polygon vertices.

Default Value
empty
shapeback to summary
private final Path2D shape

Constructor Detail

Polygonback to summary
public Polygon()

Creates an empty instance of Polygon.

Polygonback to summary
public Polygon(double... points)

Creates a new instance of Polygon.

Parameters
points:double[]

the coordinates of the polygon vertices

Method Detail

doComputeGeomBoundsback to summary
private BaseBounds doComputeGeomBounds(BaseBounds bounds, BaseTransform tx)

Hides javafx.scene.shape.Shape.doComputeGeomBounds.

doConfigShapeback to summary
private Path2D doConfigShape()
doCreatePeerback to summary
private NGNode doCreatePeer()
doUpdatePeerback to summary
private void doUpdatePeer()

Hides javafx.scene.shape.Shape.doUpdatePeer.

getPointsback to summary
public final ObservableList<Double> getPoints()

Gets the coordinates of the Polygon vertices.

Returns:ObservableList<Double>

An observable list of vertices of this Polygon

toStringback to summary
public String toString()

Overrides javafx.scene.Node.toString.

Returns a string representation of this Polygon object.

Returns:String

a string representation of this Polygon object.

Annotations
@Override