Java Reference
In-Depth Information
height: 50
fill: Color.DODGERBLUE
effect: DropShadow{}
}
]
},
We have added text objects to display the various layouts and the output for this
is shown in Figure 5.11.
Figure 5.11
Layout Bounds
As you can see, all the bounds are different. So let's examine them and determine
why they are the way they are. First, the basic rectangle is a 50 by 50 square, but
we added a DropShadow effect, which added a margin area of 10 width around
the square. So, boundsInLocal shows a 70 by 70 square starting at position -10,
-10. Notice that we are still dealing with a square and not a rectangle. This is
because boundsInLocal ignores the scaling transform. Now let's examine the
layoutBounds .
In the layoutBounds , the scale transform has been applied and the square has been
transformed into an 84 by 70 rectangle. Notice that we had to use the transforms[]
sequence as layoutBounds ignores the scaleX and scaleY variables. Also, the
other transform variables, rotate , translateX , and translateY are ignored by
the layoutBounds . LayoutBounds are different than the other bounds in that the
other bounds are read only, whereas layoutBounds can be set programmatically
when the node is first created. So, you can force the layout geometry, if desired.
Otherwise, it is calculated automatically based on the boundsInLocal augmented
with the transforms contained in the transforms sequence variable.
Search WWH ::




Custom Search