CSS: style leaks from unrelated stylesheet

David Grieve david.grieve at oracle.com
Thu Oct 9 15:20:05 UTC 2014


Try calling StyleManager.getInstance().addUserAgentStylesheet(...) from 
a static initializer, like below. If that fixes your SVG arrow problem, 
then it is a good bet that this change is the cause of your issues.

On 10/9/14, 10:23 AM, Tom Eugelink wrote:
> My controls in JFXtras have been overriding getUserAgentStylesheet 
> from day 1 (or better JavaFX 2.0), AFAIK that is the way to do it. But 
> I'm curious if this change is the cause of the CSS issues I'm seeing 
> in 8U40.
>
>
>
>
> On 9-10-2014 15:27, David Grieve wrote:
>> In 8u20 and before, adding a stylesheet via 
>> Control.getUserAgentStylesheet will simply add the user-agent 
>> stylesheet to the entire scene, not just the control. This has been 
>> fixed in 8u40 where the getUserAgentStylesheet method is now public 
>> API on Region and the styles added will affect only the Region and 
>> its children.
>>
>> Incidentally, the code you point out from the 3rd party control 
>> (controlsfx) was added as a work-around for a separate issue related 
>> to Control.getUserAgentStylesheet(). I believe the 8u40 branch of 
>> controlsfx has removed this work-around and is using the 
>> Region#getUserAgentStylesheet method.
>>
>> On 10/9/14, 8:58 AM, Werner Lehmann wrote:
>>> Turns out that the 3rd party control adds its stylesheet like this:
>>>
>>> class SomeControlSkin...
>>>   static {
>>>     StyleManager.getInstance().addUserAgentStylesheet(...)
>>>   }
>>>
>>> In this way it is not only using private API but also the stylesheet 
>>> is not associated with only such control nodes and therefore seems 
>>> to affect other nodes, too. Is this correct, and should the 
>>> stylesheet rather be provided by overriding 
>>> Control.getUserAgentStylesheet?
>>>
>>> Werner
>>>
>>> On 09.10.2014 12:00, Werner Lehmann wrote:
>>>> Then a dialog stage is displayed and its scene does not use the 3rd
>>>> party control. However, a combobox list-cell (its button cell) is 
>>>> still
>>
>



More information about the openjfx-dev mailing list