PrefWidth/Height calculations only works if stage is shown

Scott Palmer swpalmer at
Tue Sep 24 16:34:56 PDT 2013

On Wed, Aug 28, 2013 at 3:18 PM, John Smith <John_Smith at> wrote:

> I hadn't seen the applyCSS conversation, but looks like it was contained
> deep in a node validation thread:
> Looks like the request is already covered in RT-21206 as pointed out by
> David.
> Looks like the feature will show up some time post-Java8, which is why
> there is nothing on Node now.
> For now, I stick with Kevin's node snapshot workaround:
>     // create a dummy scene so layout and CSS will work
>     new Scene(new Group(node));
>     node.shapshot(...)
> Thanks for the info!

I have a need to apply the CSS so when I 'snapshot' a node that isn't in my
scene, it looks correct.
I'm doing this:
Parent p = n.getParent(); // The node I want tosnapshot isn't the root of
the graph
Scene s = KayakFXUtils.createDarkScene(p,1000,1000);

I get a reasonable size for the node, but the CSS isn't applied.

I get a ton of warnings like this:

WARNING: com.sun.javafx.css.StyleHelper calculateValue Could not resolve
'-fx-text-background-color' while resolving lookups for '-fx-text-fill'
from rule '*.label' in stylesheet


More information about the openjfx-dev mailing list