Class Control

    • Constructor Detail

      • Control

        protected Control​()
        Create a new Control.
    • Method Detail

      • skinProperty

        public final ObjectProperty<Skin<?>> skinProperty​()
        Skin is responsible for rendering this Control. From the perspective of the Control, the Skin is a black box. It listens and responds to changes in state in a Control.

        There is a one-to-one relationship between a Control and its Skin. Every Skin maintains a back reference to the Control via the Skin.getSkinnable() method.

        A skin may be null.

        Specified by:
        skinProperty in interface Skinnable
        See Also:
        getSkin(), setSkin(Skin)
      • setSkin

        public final void setSkin​(Skin<?> value)
        Sets the value of the property skin.
        Specified by:
        setSkin in interface Skinnable
        Property description:
        Skin is responsible for rendering this Control. From the perspective of the Control, the Skin is a black box. It listens and responds to changes in state in a Control.

        There is a one-to-one relationship between a Control and its Skin. Every Skin maintains a back reference to the Control via the Skin.getSkinnable() method.

        A skin may be null.

        Parameters:
        value - the skin value for this control
      • getSkin

        public final Skin<?> getSkin​()
        Gets the value of the property skin.
        Specified by:
        getSkin in interface Skinnable
        Property description:
        Skin is responsible for rendering this Control. From the perspective of the Control, the Skin is a black box. It listens and responds to changes in state in a Control.

        There is a one-to-one relationship between a Control and its Skin. Every Skin maintains a back reference to the Control via the Skin.getSkinnable() method.

        A skin may be null.

        Returns:
        the skin for this control
      • setTooltip

        public final void setTooltip​(Tooltip value)
        Sets the value of the property tooltip.
        Property description:
        The ToolTip for this control.
      • getTooltip

        public final Tooltip getTooltip​()
        Gets the value of the property tooltip.
        Property description:
        The ToolTip for this control.
      • setContextMenu

        public final void setContextMenu​(ContextMenu value)
        Sets the value of the property contextMenu.
        Property description:
        The ContextMenu to show for this control.
      • getContextMenu

        public final ContextMenu getContextMenu​()
        Gets the value of the property contextMenu.
        Property description:
        The ContextMenu to show for this control.
      • computeMinWidth

        protected double computeMinWidth​(double height)
        Computes the minimum allowable width of the Control, based on the provided height. The minimum width is not calculated within the Control, instead the calculation is delegated to the Node.minWidth(double) method of the Skin. If the Skin is null, the returned value is 0.
        Overrides:
        computeMinWidth in class Region
        Parameters:
        height - The height of the Control, in case this value might dictate the minimum width.
        Returns:
        A double representing the minimum width of this control.
      • computeMinHeight

        protected double computeMinHeight​(double width)
        Computes the minimum allowable height of the Control, based on the provided width. The minimum height is not calculated within the Control, instead the calculation is delegated to the Node.minHeight(double) method of the Skin. If the Skin is null, the returned value is 0.
        Overrides:
        computeMinHeight in class Region
        Parameters:
        width - The width of the Control, in case this value might dictate the minimum height.
        Returns:
        A double representing the minimum height of this control.
      • computeMaxWidth

        protected double computeMaxWidth​(double height)
        Computes the maximum allowable width of the Control, based on the provided height. The maximum width is not calculated within the Control, instead the calculation is delegated to the Node.maxWidth(double) method of the Skin. If the Skin is null, the returned value is 0.
        Overrides:
        computeMaxWidth in class Region
        Parameters:
        height - The height of the Control, in case this value might dictate the maximum width.
        Returns:
        A double representing the maximum width of this control.
      • computeMaxHeight

        protected double computeMaxHeight​(double width)
        Computes the maximum allowable height of the Control, based on the provided width. The maximum height is not calculated within the Control, instead the calculation is delegated to the Node.maxHeight(double) method of the Skin. If the Skin is null, the returned value is 0.
        Overrides:
        computeMaxHeight in class Region
        Parameters:
        width - The width of the Control, in case this value might dictate the maximum height.
        Returns:
        A double representing the maximum height of this control.
      • computePrefWidth

        protected double computePrefWidth​(double height)
        Computes the preferred width of this region for the given height. Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a VERTICAL content bias, then the height parameter can be ignored.
        Overrides:
        computePrefWidth in class Region
        Parameters:
        height - the height that should be used if preferred width depends on it
        Returns:
        the computed preferred width for this region
      • computePrefHeight

        protected double computePrefHeight​(double width)
        Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a HORIZONTAL content bias, then the width parameter can be ignored.
        Overrides:
        computePrefHeight in class Region
        Parameters:
        width - the width that should be used if preferred height depends on it
        Returns:
        the computed preferred height for this region
      • getBaselineOffset

        public double getBaselineOffset​()
        Calculates the baseline offset based on the first managed child. If there is no such child, returns Node.getBaselineOffset().
        Overrides:
        getBaselineOffset in class Parent
        Returns:
        baseline offset
      • layoutChildren

        protected void layoutChildren​()
        Invoked during the layout pass to layout the children in this Parent. By default it will only set the size of managed, resizable content to their preferred sizes and does not do any node positioning.

        Subclasses should override this function to layout content as needed.

        Overrides:
        layoutChildren in class Parent
      • createDefaultSkin

        protected Skin<?> createDefaultSkin​()
        Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).
        Returns:
        new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
        Since:
        JavaFX 8.0
      • getClassCssMetaData

        public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData​()
        Returns:
        The CssMetaData associated with this class, which may include the CssMetaData of its superclasses.
        Since:
        JavaFX 8.0
      • getControlCssMetaData

        protected List<CssMetaData<? extends Styleable,?>> getControlCssMetaData​()
        Returns:
        unmodifiable list of the controls css styleable properties
        Since:
        JavaFX 8.0
      • getInitialFocusTraversable

        protected Boolean getInitialFocusTraversable​()
        Returns the initial focus traversable state of this control, for use by the JavaFX CSS engine to correctly set its initial value. By default all UI controls are focus traversable, so this method is overridden in Control to set the initial traversable state to true.
        Overrides:
        getInitialFocusTraversable in class Node
        Returns:
        the initial focus traversable state of this control
        Since:
        9
      • queryAccessibleAttribute

        public Object queryAccessibleAttribute​(AccessibleAttribute attribute,
                                               Object... parameters)
        This method is called by the assistive technology to request the value for an attribute.

        This method is commonly overridden by subclasses to implement attributes that are required for a specific role.
        If a particular attribute is not handled, the superclass implementation must be called.

        Overrides:
        queryAccessibleAttribute in class Parent
        Parameters:
        attribute - the requested attribute
        parameters - optional list of parameters
        Returns:
        the value for the requested attribute
        See Also:
        AccessibleAttribute
      • executeAccessibleAction

        public void executeAccessibleAction​(AccessibleAction action,
                                            Object... parameters)
        This method is called by the assistive technology to request the action indicated by the argument should be executed.

        This method is commonly overridden by subclasses to implement action that are required for a specific role.
        If a particular action is not handled, the superclass implementation must be called.

        Overrides:
        executeAccessibleAction in class Node
        Parameters:
        action - the action to execute
        parameters - optional list of parameters
        See Also:
        AccessibleAction