Module MaterialFX

Interface MFXStyleablePopup

All Known Implementing Classes:
MFXContextMenu, MFXPopup, MFXTooltip

public interface MFXStyleablePopup
JavaFX offers a special type of Popup, the PopupControl, to allow styling its content with CSS. It would be a great control....if only it worked properly, but just like most of JavaFX's controls it is borked too because those code monkeys at JavaFX are dumb.

Since I could not make it work no matter what I tried I was tired of this bullshit and designed my own solution.

MFXPopup now implements this interface allowing CSS to really fucking work as it should!

The system is quite simple at the moment:

First when creating a MFXStyleablePopup you must set which is the parent that has the stylesheet, use setPopupStyleableParent(Parent). Then the interface, thanks to a helper class (the MFXCSSBridge, will parse the parent's user agent stylesheet and all its stylesheets automatically, even if changed at runtime (the list will always be rebuilt for simplicity). Then it's up to the popup implementation to connect the bridge to the node on which apply the stylesheets.

  • Method Details

    • getPopupStyleableParent

      Parent getPopupStyleableParent()
      Returns:
      the node that has the necessary stylesheets to customize the popup
    • setPopupStyleableParent

      void setPopupStyleableParent(Parent parent)
      Sets the node that has the necessary stylesheets to customize the popup.
    • getStyleSheets

      ObservableList<String> getStyleSheets()
      Returns:
      the parsed stylesheets
    • getUserAgentStylesheet

      String getUserAgentStylesheet()
      This method works just like Region.getUserAgentStylesheet().

      Any MFXStyleablePopup should offer the possibility of setting a base stylesheet. It's up to the skin on how to use it though (an example can be found here MFXContextMenuSkin).