title: How do I resize a polygon?
body: <p>My assignment is to make a smiley face that, when the windows resizes, fits in the borders. I can get all the other shapes to do that, but when I try with a polygon, I don't know how to do this. So if I could have help on how to resize a polygon from the javafx.node.shape.Shape package, that'd be great.</p>
  
  <p>As always thanks for your timely help and I'm very sorry if I have violated many rules.   </p>
  
  <pre><code>    import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.layout.Pane;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Circle;
      import javafx.stage.Stage;
      import javafx.scene.shape.Polygon;
      import javafx.scene.shape.Ellipse;
      import javafx.scene.shape.*;
  
      public class smiley extends Application{
        @Override // Override the start method in the Application class
        public void start(Stage primaryStage) {
          Pane pane = new Pane();
          // Create a circle and set its properties
          Circle circle = new Circle();
          circle.centerXProperty().bind(pane.widthProperty().divide(2));
          circle.centerYProperty().bind(pane.heightProperty().divide(2)); 
          circle.setRadius(50);
          circle.setStroke(Color.BLACK);
          circle.setFill(null);
  
          Polygon nose = new Polygon();
          nose.getPoints().addAll(new Double[]{ 100.0, 90.0, 90.0, 120.0, 110.0, 120.0 });
          nose.setStroke(Color.BLACK);
          nose.setFill(null);
  
          Ellipse leftEye = new Ellipse();
          leftEye.centerXProperty().bind(pane.widthProperty().divide(2).add(20));
          leftEye.centerYProperty().bind(pane.heightProperty().divide(2).subtract(20));
          leftEye.setRadiusX(15.0f);
          leftEye.setRadiusY(10.0f);
          leftEye.setStroke(Color.BLACK);
          leftEye.setFill(null);
  
          Ellipse rightEye = new Ellipse();
          rightEye.centerXProperty().bind(pane.widthProperty().divide(2).subtract(20));
          rightEye.centerYProperty().bind(pane.heightProperty().divide(2).subtract(20));
          rightEye.setRadiusX(15.0f);
          rightEye.setRadiusY(10.0f);
          rightEye.setStroke(Color.BLACK);
          rightEye.setFill(null);
  
          Circle leftPupil = new Circle();
          leftPupil.centerXProperty().bind(pane.widthProperty().divide(2).add(20));
          leftPupil.centerYProperty().bind(pane.heightProperty().divide(2).subtract(20));
          leftPupil.setRadius(7);
          leftPupil.setStroke(Color.BLACK);
  
          Circle rightPupil = new Circle();
          rightPupil.centerXProperty().bind(pane.widthProperty().divide(2).subtract(20));
          rightPupil.centerYProperty().bind(pane.heightProperty().divide(2).subtract(20));
          rightPupil.setRadius(7);
          rightPupil.setStroke(Color.BLACK);
  
          Arc smile = new Arc();
          smile.centerXProperty().bind(pane.widthProperty().divide(2));
          smile.centerYProperty().bind(pane.heightProperty().divide(2).add(20));
          smile.setRadiusX(25.0f);
          smile.setRadiusY(10.0f);
          smile.setStartAngle(180.0f);
          smile.setLength(180.0f);
          smile.setType(ArcType.OPEN);
          smile.setFill(null);
          smile.setStroke(Color.BLACK);
  
          pane.getChildren().add(circle);
          pane.getChildren().add(nose);
          pane.getChildren().add(leftEye);
          pane.getChildren().add(rightEye);
          pane.getChildren().add(leftPupil);
          pane.getChildren().add(rightPupil);
          pane.getChildren().add(smile);
  
          // Create a scene and place it in the stage
          Scene scene = new Scene(pane, 200, 200);
          primaryStage.setTitle("Assignment 14"); // Set the stage title
          primaryStage.setScene(scene); // Place the scene in the stage
          primaryStage.show(); // Display the stage
  
  
        }
      } 
  </code></pre>