Module MaterialFX

Class MFXContextMenuSkin

java.lang.Object
io.github.palexdev.materialfx.skins.MFXContextMenuSkin
All Implemented Interfaces:
Skin<MFXContextMenu>

public class MFXContextMenuSkin extends Object implements Skin<MFXContextMenu>
Skin associated with every MFXContextMenu by default.

This is very similar to MFXPopupSkin but there are two containers. The top container is a MFXScrollPane, because sometimes context menus can contain lots of items, but it is desirable to keep it under a certain height and make it scrollable. Then there's a VBox containing all the items specified by MFXContextMenu.getItems(), this box is set as the content of the scroll pane.

A little side note on the popup's MFXPopup.contentProperty():

MFXContextMenu is a special case of MFXPopup. This skin is responsible for setting the popup's content to the aforementioned scroll pane. While it still allows to change the content whenever you want, it's nonsense, so don't do it.