Top Description Methods
javafx.scene.control

public Interface Skin<C extends Skinnable>

Known Direct Implementers
javafx.scene.control.SkinBase, javafx.scene.control.skin.ContextMenuSkin, javafx.scene.control.skin.TooltipSkin, com.sun.javafx.scene.control.skin.InputFieldSkin
Type Parameters
<C>
A subtype of Skinnable that the Skin represents. This allows for Skin implementation to access the Skinnable implementation, which is usually a Control implementation.
Imports
javafx.scene.Node

An interface for defining the visual representation of user interface controls.

A Skin implementation should generally avoid modifying its control outside of install() method. The life cycle of a Skin implementation is as follows:

Since
JavaFX 2.0

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Called when a previously installed skin is about to be removed from its associated control.

public Node

Returns:

A non-null Node, except when the Skin has been disposed.
getNode
()

Gets the Node which represents this Skin.

public C

Returns:

A non-null Skinnable, or null value if disposed.
getSkinnable
()

Gets the Skinnable to which this Skin is assigned.

public default void
install()

Called once when Skin is set.

Method Detail

disposeback to summary
public void dispose()

Called when a previously installed skin is about to be removed from its associated control. This allows the skin to do clean up, like removing listeners and bindings, and undo any changes to the control's properties. After this method completes, getSkinnable() and getNode() should return null.

Calling dispose() more than once has no effect.

getNodeback to summary
public Node getNode()

Gets the Node which represents this Skin. This must never be null, except after a call to dispose(), and must never change except when changing to null.

Returns:Node

A non-null Node, except when the Skin has been disposed.

getSkinnableback to summary
public C 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 dispose().

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

Returns:C

A non-null Skinnable, or null value if disposed.

installback to summary
public default void install()

Called once when Skin is set. This method is called after the previous skin, if any, has been uninstalled via its dispose() method. The skin can now safely make changes to its associated control, like registering listeners, adding child nodes, and modifying properties and event handlers.

Application code must not call this method.

The default implementation of this method does nothing.

Implementation Note

Skins only need to implement install if they need to make direct changes to the control like overwriting properties or event handlers. Such skins should ensure these changes are undone in their dispose() method.

Since
20