Skin layoutChildren: when to get bounds of child nodes?

Werner Lehmann lehmann at
Wed Jul 30 12:29:59 UTC 2014


since I need to get x and width of child1 (the one inside the hbox) I 
have to use boundsInParent. According to the docs layoutBounds.x/y are 
always zero for resizable nodes so it does not work here. As to the 
question whether the parent might be size 0: the HBox is indeed size 0 
after the initial call to super.layoutChildren. The containing VBox has 
some 800x400 px though.

I think the reason is probably in Martin's reply although I may not like 
it ;-)


On 25.07.2014 18:56, Richard Bair wrote:
> Hmmm. The first question I have is whether boundsInParent is really
> what you want to use, vs. layout bounds. But assuming it is what you
> want, why are the bounds zero? This is during the layout pass, which
> is the right place to be doing what you’re doing. The super
> layoutChildren call will size everything based on the contentX,
> contentY, contentWidth, contentHeight
> (
> Is it possible that the parent itself is size 0? boundsInParent
> should always be invalidated automatically whenever the
> width/height/transforms/etc changes. If not that is definitely a bug
> (that you can write a simple test case for to prove).
> But my first guess is maybe the parent is size 0 as well, due to
> something else (maybe the pref size of the control is 0 to start with
> or something…)
> Richard

More information about the openjfx-dev mailing list