title: Get the size of a Node in a given layout in javafx 2.0?
body: <p>In the skin of a custom control I would like to draw a triangle the size of the control, and have the triangle grow as the frame is resized. I have the following code but the bounds only increase in size as I resize the frame. How to I get it to resize correctly?</p>
  
  <pre><code>private void update()
  {
      Bounds bounds = node.getBoundsInParent();
      Path path = new Path();
      path.getElements().add(
              new MoveTo(
              bounds.getWidth() / 2 + bounds.getMinX(), 
              bounds.getMinY()));
      path.getElements().add(
              new LineTo(bounds.getMaxX(), bounds.getMaxY()));
      path.getElements().add(
              new LineTo(bounds.getMinX(), bounds.getMaxY()));
     path.setFill(Color.RED);
     node.getChildren().setAll(path);                
  }
  </code></pre>
  
  <p>Edit: Using swing I would do the following. But I can't get it to work in JavaFX.</p>
  
  <pre><code>public class Arrow extends JPanel
  {
  
  @Override
  protected void paintComponent(Graphics graphics) {
      super.paintComponent(graphics);
      Dimension size = getSize();
  
      Point top = new Point(size.width/2,0);
      Point bottomRight = new Point(size.width, size.height);
      Point bottomLeft = new Point(0, size.height);
  
      GeneralPath path = new GeneralPath();
      path.moveTo(top.x, top.y);
      path.lineTo(bottomRight.x, bottomRight.y);
      path.lineTo(bottomLeft.x, bottomLeft.y);
      path.lineTo(top.x, top.y);
  
      Graphics2D g2d = (Graphics2D)graphics.create();
      g2d.setColor(Color.RED);
      g2d.fill(path);
      g2d.dispose();
  }
  }
  </code></pre>