JavaFX Tutorial - Java Polygon.getPoints()








Syntax

Polygon.getPoints() has the following syntax.

public final ObservableList <java.lang.Double> getPoints()

Example

In the following code shows how to use Polygon.getPoints() method.

/*from  w  w  w .j a va 2s .  c o  m*/
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.shape.Polygon;
import javafx.stage.Stage;

public class Main extends Application {

  @Override
  public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);

    Group g = new Group();

    Polygon polygon = new Polygon(0.0, 0.0,20.0, 10.0,10.0, 20.0);
    
    g.getChildren().add(polygon);
    
    System.out.println(polygon.getPoints());
    
    scene.setRoot(g);
    stage.show();
  }

  public static void main(String[] args) {
    launch(args);
  }
}