Module javafx.controls
Package javafx.scene.control.skin

# Class ContextMenuSkin

java.lang.Object
javafx.scene.control.skin.ContextMenuSkin

All Implemented Interfaces:
  `Skin<ContextMenu>`

    public class ContextMenuSkin
    extends Object
    implements Skin<ContextMenu>

Default Skin implementation for ContextMenu. Several controls use ContextMenu in order to display items in a drop down. This class mostly deals mostly with show / hide logic - the actual content of the context menu is contained within the `root node`.

Since:
  9
See Also:
  `ContextMenu`

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `ContextMenuSkin​(ContextMenu control)` | Creates a new ContextMenuSkin instance.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `void` | `dispose()` | Called by a Skinnable when the Skin is replaced on the Skinnable.
  `Node` | `getNode()` | Gets the Node which represents this Skin.
  `ContextMenu` | `getSkinnable()` | Gets the Skinnable to which this Skin is assigned.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ContextMenuSkin

    public ContextMenuSkin​(ContextMenu control)
    Creates a new ContextMenuSkin instance.
    Parameters:
      `control` - The control that this skin should be installed onto.

- ## Method Details

  - ### getSkinnable

    public ContextMenu getSkinnable()
    Gets the Skinnable to which this Skin is assigned. A Skin must be created for one and only one Skinnable. This value will only ever go from a non-null to null value when the Skin is removed from the Skinnable, and only as a consequence of a call to `Skin.dispose()`.

    The caller who constructs a Skinnable must also construct a Skin and properly establish the relationship between the Control and its Skin.

    Specified by:
      `getSkinnable` in interface `Skin<ContextMenu>`
    Returns:
      A non-null Skinnable, or null value if disposed.

  - ### getNode

    public Node getNode()
    Gets the Node which represents this Skin. This must never be null, except after a call to `Skin.dispose()`, and must never change except when changing to null.
    Specified by:
      `getNode` in interface `Skin<ContextMenu>`
    Returns:
      A non-null Node, except when the Skin has been disposed.

  - ### dispose

    public void dispose()
    Called by a Skinnable when the Skin is replaced on the Skinnable. This method allows a Skin to implement any logic necessary to clean up itself after the Skin is no longer needed. It may be used to release native resources. The methods `Skin.getSkinnable()` and `Skin.getNode()` should return null following a call to dispose. Calling dispose twice has no effect.
    Specified by:
      `dispose` in interface `Skin<ContextMenu>`