Node bounds documentation issue?

Scott Palmer swpalmer at
Mon Jul 8 09:20:52 PDT 2013

The javadocs discussing Bounding Rectangles for Node state:

"The images show a filled and stroked rectangle and their bounds. The first
rectangle [x:10.0 y:10.0 width:100.0 height:100.0 strokeWidth:0] has the
following bounds bounds: [x:10.0 y:10.0 width:100.0 height:100.0]. The
second rectangle [x:10.0 y:10.0 width:100.0 height:100.0 strokeWidth:5] has
the following bounds: [x:5.0 y:5.0 width:110.0 height:110.0]. Since neither
of the rectangles has any transformation applied, boundsInParent and
boundsInLocal are the same."

But I think that is wrong, or at least incomplete and potentially
misleading.  Rectangle is a Shape so the StrokeType matters here and the
default StrokeType is CENTERED.  (Though when I drop one on the Scene in
Scene Builder, it defaults to INSIDE, something that I think should be
considered a SceneBuilder bug.)

So by default the bounds would be only extending 2.5 on each side for a
total width and height of 105 and x and y coordinates of 7.5.


More information about the openjfx-dev mailing list