title: Binding a Shape class to the StackPane height
body: <p><strong>Scenario</strong> : A Stage contains a Scene.The Scene contains a StackPane. The height and width of the StackPane and Scene are bind together. The StackPane contains a Shape which is a union of Rectangle and Shape.</p>
  
  <p><strong>Issue</strong> - I am facing issue while binding a Shape class to the height of StackPane. How to bind a particular part of Shape class or the complete Shape class in my example?</p>
  
  <p><strong>Requirement</strong> - I have 2 requirements.</p>
  
  <ol>
  <li>When I maximize the stage, the StackPane gets increased since the
  height and width are bind to Scene but the Shape doesnt increase. I
  need both the Shape's(<code>smallShape</code> and <code>bigRectangle</code>) to increase
  in terms of height only.</li>
  <li>When I maximize the stage the StackPane should increase as well as only the bigger rectangle height should increase but not the other small rectangle i.e <code>bigRectangle</code> height should increase only.</li>
  </ol>
  
  <p>Below is my code snippet</p>
  
  <pre><code>package application;
  
  import javafx.application.Application;
  import javafx.scene.Group;
  import javafx.scene.Scene;
  import javafx.scene.layout.StackPane;
  import javafx.scene.paint.Color;
  import javafx.scene.shape.Rectangle;
  import javafx.scene.shape.RectangleBuilder;
  import javafx.scene.shape.Shape;
  import javafx.stage.Stage;
  
  public class BindingShape extends Application {
  
      @Override
      public void start(Stage primaryStage) throws Exception {
  
          StackPane stackPane = new StackPane();
          stackPane.setPrefHeight(200);
          stackPane.setPrefWidth(200);
          stackPane.setStyle("-fx-background-color: BEIGE");
          Shape smallShape = RectangleBuilder.create()
                  .x(0)
                  .y(3)
                  .arcWidth(6)
                  .arcHeight(6)
                  .width(50) // allow overlap for union of tab and content rectangle
                  .height(50)
                  .build();
  
          Rectangle bigRectangle = RectangleBuilder.create()
                  .x(25)
                  .y(0)
                  .arcWidth(10)
                  .arcHeight(10)
                  .width(100)
                  .height(100)
                  .build();
          Shape unionShape = Shape.union(smallShape, bigRectangle);
          unionShape.setFill(Color.rgb(0, 0, 0, .50));
          unionShape.setStroke(Color.BLUE);
  
          Group shapeGroup = new Group();
          shapeGroup.getChildren().add(unionShape);
          stackPane.getChildren().add(shapeGroup);
  
          Group paneGroup = new Group();
          paneGroup.getChildren().add(stackPane);
  
          Scene scene = new Scene(paneGroup, 400, 400,Color.LIGHTSKYBLUE);
          stackPane.prefHeightProperty().bind(scene.heightProperty().divide(2));
          stackPane.prefWidthProperty().bind(scene.widthProperty().divide(2));
          primaryStage.setScene(scene);
          primaryStage.show();
      }
      public static void main(String[] args) {
          launch(args);
      }
  
  }
  </code></pre>
  
  <p>Please let me know the solution. Thanks in advance.</p>