title: How do I create a class (e.g Triangle) that extends Polygon in JavaFX?
body: <p>I keep getting errors, or just a blank scene.
  Below is the compiling code that shows nothing.
  I think the problem is in my class Triangle, but I have a limited understanding of JavaFX and extends classes.</p>
  
  <pre><code>public class Board extends Application {
  
  @Override
  public void start(Stage stage){
      stage.setTitle("Board");
      Group root = new Group();
      Scene scene = new Scene(root, 600, 519);
      stage.setScene(scene);
  
      Triangle t1 = new Triangle(300,259.5,200);
      t1.draw();
      t1.setFill(Color.LIGHTGRAY);
      root.getChildren().add(t1);
      stage.show();
  }
  
  class Triangle extends Polygon {
      double x;
      double y;
      double side;
  
      Triangle(double x, double y, double side){
          this.x = x;
          this.y = y;
          this.side = side;
      }
  
      Triangle draw(){
          Triangle triangle = new Triangle(x,y,side);
          triangle.setLayoutX(x);
          triangle.setLayoutY(y);
          triangle.getPoints().addAll(
                  x, (-(Math.sqrt((side*side)-((side/2)*(side/2)))/2)),
                  (side/2), Math.sqrt((side*side)-((side/2)*(side/2)))/2,
                  (-(side/2)), Math.sqrt((side*side)-((side/2)*(side/2)))/2);
          return triangle;
      }
  }
  
  public static void main(String[] args) {
      launch(args);
  }
  }
  </code></pre>