Calculating the preferred size of a node before layout takes place?

Richard Bair richard.bair at oracle.com
Mon Aug 4 18:03:54 UTC 2014


autosize() on Node may be what you want (sizes it then afterward you can read values)?

On Aug 4, 2014, at 10:56 AM, Mike Hearn <mike at plan99.net> wrote:

> I'd like to find the calculated height of a node in my window controllers
> initialise() method, so I can shrink the height to zero and then animate it
> to the right size later. However getHeight and getPrefHeight both return
> zero in this method, presumably because it's not been laid out yet.
> 
> I tried calling layout() but that didn't help.
> 
> I don't want any visual glitches caused by a node being visible and then
> immediately resized to invisibility. Is there a solution to my problem? I
> feel there must be an obvious one that I'm just overlooking somehow ...
> 
> thanks!



More information about the openjfx-dev mailing list