ContextMenu styling (esp. for MenuButton)
Werner Lehmann
lehmann at media-interactive.de
Wed Oct 24 05:58:28 PDT 2012
Randahl,
the problem is not about using selectors (this works) - it is about
ContextMenu being a PopupControl having a separate scene having a
different stylesheet.
If you want to style a ContextMenu you have to add your stylesheet to
ContextMenu.scene.root.styleSheets. This is difficult if the particular
instance of a context menu is a private field of a MenuButton skin.
Currently I get around this just by using a CustomMenuItem which uses a
provided node which in turn has an invalidation listener on the scene
property. Not pretty... ;-)
And this won't work for MenuButton if the menu has no custom items.
Which is still an open problem...
Werner
On 24.10.2012 14:13, Randahl Fink Isaksen wrote:
> I have had success with using nested selectors such as
>
> .myusecase .button {}
>
> where .myusecase is a style class added to a parent component by my
> app and .button is the style class that Button adds itself. This
> affects only buttons in that particular use-case. Couldn't you do
> something similar, of course with whatever style class the popup
> has?
>
> R.
More information about the openjfx-dev
mailing list