I'm trying to set the shape property of an hbox to a polygon. The following code is within a class that extends Hbox with a constructor that requires a list of points called origPoints
.
val polygon = new javafx.scene.shape.Polygon()
origPoints.foreach{case (x,y) => polygon.getPoints.addAll(x,y)}
setShape(polygon)
setStyle("-fx-border-color: red")
Sorry if the syntax is a little different. I am using ScalaFX, but I don't believe that is causing any issues in this case.
For more information: I am making an intractable map of the United States. I have the coordinates mapped out for each state. I would like to have the advantages of using an hbox, such as being able to add children such as text.