Get style properties

Mario Torre neugens at
Tue Jun 18 12:54:33 PDT 2013

Hi all!

I was trying to figure out how JavaFX parses and uses the style under
the hood and I stumbled on something I don't fully understand (I admit
I'm not really a CSS expert yet :).

In the modena.css, right at the .root selector we have:

    /* These are needed for Popup */
    -fx-background-color: inherit;
    -fx-background-radius: inherit;
    -fx-background-insets: inherit;
    -fx-padding: inherit;

and then, few lines below:

    -fx-background-color: -fx-background;

Is this intentional? How does JavaFX understand which value to choose?

It seems (but I'm far from discovering the trick) that both values are
preserved, but how does the system know which one to use?

I assume that "inherit" is what is doing the magic here, probably by
delegating to the closest matching declaration, but it's still not clear
to me how everything is resolved.

Also, is there a way to retrive fully resolved values? I would like
something like this, basically:


Or such.

I found a way to match declared styles and basically get a StyleMap, but
this uses internal API I wanted to check if I'm missing some obvious
way, perhaps?


More information about the openjfx-dev mailing list