java.lang.Object
- All Implemented Interfaces:
Skin<ComboBoxBase<Color>>
public class ColorPickerSkin extends ComboBoxPopupControl<Color>
Default skin implementation for the
ColorPicker
control.- Since:
- 9
- See Also:
ColorPicker
-
Constructor Summary
Constructors Constructor Description ColorPickerSkin(ColorPicker control)
Creates a new ColorPickerSkin instance, installing the necessary child nodes into the Controlchildren
list, as well as the necessary input mappings for handling key, mouse, etc events. -
Method Summary
Modifier and Type Method Description protected double
computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
Calculates the preferred width of thisSkinBase
.void
dispose()
Called by a Skinnable when the Skin is replaced on the Skinnable.static List<CssMetaData<? extends Styleable,?>>
getClassCssMetaData()
Returns the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.protected StringConverter<Color>
getConverter()
Subclasses are responsible for getting the converter.List<CssMetaData<? extends Styleable,?>>
getCssMetaData()
This method should delegate toNode.getClassCssMetaData()
so that a Node's CssMetaData can be accessed without the need for reflection.Node
getDisplayNode()
This method should return a Node that will be positioned within the ComboBox 'button' area.protected TextField
getEditor()
ColorPicker does not use a main text field, so this method has been overridden to return null.protected Node
getPopupContent()
This method should return the Node that will be displayed when the user clicks on the ComboBox 'button' area.protected void
layoutChildren(double x, double y, double w, double h)
Called during the layout pass of the scenegraph.void
show()
This method will be called when the ComboBox popup should be displayed.Methods inherited from class javafx.scene.control.skin.ComboBoxBaseSkin
computeBaselineOffset, computeMaxHeight, computeMaxWidth, computePrefHeight
Methods inherited from class javafx.scene.control.SkinBase
computeMinHeight, computeMinWidth, consumeMouseEvents, executeAccessibleAction, getChildren, getNode, getSkinnable, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, queryAccessibleAttribute, registerChangeListener, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, unregisterChangeListeners
-
Constructor Details
-
ColorPickerSkin
Creates a new ColorPickerSkin instance, installing the necessary child nodes into the Controlchildren
list, as well as the necessary input mappings for handling key, mouse, etc events.- Parameters:
control
- The control that this skin should be installed onto.
-
-
Method Details
-
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 methodsSkin.getSkinnable()
andSkin.getNode()
should return null following a call to dispose. Calling dispose twice has no effect.- Specified by:
dispose
in interfaceSkin<ComboBoxBase<Color>>
- Overrides:
dispose
in classSkinBase<ComboBoxBase<Color>>
-
computePrefWidth
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)Calculates the preferred width of thisSkinBase
. The default implementation calculates this width as the width of the area occupied by its managed children when they are positioned at their current positions at their preferred widths.- Overrides:
computePrefWidth
in classComboBoxBaseSkin<Color>
- Parameters:
height
- the height that should be used if preferred width depends on ittopInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left inset- Returns:
- the calculated preferred width
-
getPopupContent
This method should return the Node that will be displayed when the user clicks on the ComboBox 'button' area.- Specified by:
getPopupContent
in classComboBoxPopupControl<Color>
- Returns:
- the Node that will be displayed when the user clicks on the ComboBox 'button' area
-
show
public void show()This method will be called when the ComboBox popup should be displayed. It is up to specific skin implementations to determine how this is handled.- Overrides:
show
in classComboBoxPopupControl<Color>
-
getDisplayNode
This method should return a Node that will be positioned within the ComboBox 'button' area.- Specified by:
getDisplayNode
in classComboBoxBaseSkin<Color>
- Returns:
- the node that will be positioned within the ComboBox 'button' area
-
layoutChildren
protected void layoutChildren(double x, double y, double w, double h)Called during the layout pass of the scenegraph.- Overrides:
layoutChildren
in classComboBoxBaseSkin<Color>
- Parameters:
x
- the x positiony
- the y positionw
- the widthh
- the height
-
getClassCssMetaData
Returns the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.- Returns:
- the CssMetaData associated with this class, which may include the CssMetaData of its superclasses
-
getCssMetaData
This method should delegate toNode.getClassCssMetaData()
so that a Node's CssMetaData can be accessed without the need for reflection.- Overrides:
getCssMetaData
in classSkinBase<ComboBoxBase<Color>>
- Returns:
- The CssMetaData associated with this node, which may include the CssMetaData of its superclasses.
-
getConverter
Subclasses are responsible for getting the converter. This will be removed in FX 9 when the converter property is moved up to ComboBoxBase with JDK-8130354.- Specified by:
getConverter
in classComboBoxPopupControl<Color>
- Returns:
- the string converter
-
getEditor
ColorPicker does not use a main text field, so this method has been overridden to return null.- Specified by:
getEditor
in classComboBoxPopupControl<Color>
- Returns:
- the editor
-