Class Separator

  • All Implemented Interfaces:
    Styleable, EventTarget, Skinnable

    public class Separator
    extends Control
    A horizontal or vertical separator line. The visual appearance of this separator can be controlled via CSS. A horizontal separator occupies the full horizontal space allocated to it (less padding), and a vertical separator occupies the full vertical space allocated to it (less padding). The halignment and valignment properties determine how the separator is positioned in the other dimension, for example, how a horizontal separator is positioned vertically within its allocated space.

    The separator is horizontal (i.e. isVertical() == false) by default.

    The style-class for this control is "separator".

    The separator provides two pseudo-classes "horizontal" and "vertical" which are mutually exclusive. The "horizontal" pseudo-class applies if the separator is horizontal, and the "vertical" pseudo-class applies if the separator is vertical.

    Separator sets focusTraversable to false.

    Example:

     Button b0 = new Button("Button 0");
     Button b1 = new Button("Button 1");
     Button b2 = new Button("Button 2");
     Button b3 = new Button("Button 3");
     Separator separator = new Separator(Orientation.HORIZONTAL);
     VBox vBox = new VBox(b0, b1, separator, b2, b3);
    Image of the Separator control
    Since:
    JavaFX 2.0
    • Constructor Detail

      • Separator

        public Separator()
        Creates a new horizontal separator with halignment and valignment set to their respective CENTER values.
      • Separator

        public Separator​(Orientation orientation)
        Creates a new separator with halignment and valignment set to their respective CENTER values. The direction of the separator is specified by the vertical property.
        Parameters:
        orientation - Specifies whether the Separator instance is initially vertical or horizontal.
    • Method Detail

      • setOrientation

        public final void setOrientation​(Orientation value)
        Sets the value of the property orientation.
        Property description:
        The orientation of the Separator can either be horizontal or vertical.
      • getOrientation

        public final Orientation getOrientation()
        Gets the value of the property orientation.
        Property description:
        The orientation of the Separator can either be horizontal or vertical.
      • setHalignment

        public final void setHalignment​(HPos value)
        Sets the value of the property halignment.
        Property description:
        For vertical separators, specifies the horizontal position of the separator line within the separator control's space. Ignored for horizontal separators.
      • getHalignment

        public final HPos getHalignment()
        Gets the value of the property halignment.
        Property description:
        For vertical separators, specifies the horizontal position of the separator line within the separator control's space. Ignored for horizontal separators.
      • halignmentProperty

        public final ObjectProperty<HPos> halignmentProperty()
        For vertical separators, specifies the horizontal position of the separator line within the separator control's space. Ignored for horizontal separators.
        See Also:
        getHalignment(), setHalignment(HPos)
      • setValignment

        public final void setValignment​(VPos value)
        Sets the value of the property valignment.
        Property description:
        For horizontal separators, specifies the vertical alignment of the separator line within the separator control's space. Ignored for vertical separators.
      • getValignment

        public final VPos getValignment()
        Gets the value of the property valignment.
        Property description:
        For horizontal separators, specifies the vertical alignment of the separator line within the separator control's space. Ignored for vertical separators.
      • valignmentProperty

        public final ObjectProperty<VPos> valignmentProperty()
        For horizontal separators, specifies the vertical alignment of the separator line within the separator control's space. Ignored for vertical separators.
        See Also:
        getValignment(), setValignment(VPos)
      • 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(...).
        Overrides:
        createDefaultSkin in class Control
        Returns:
        new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
      • 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
      • 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. This method is overridden as by default UI controls have focus traversable set to true, but that is not appropriate for this control.
        Overrides:
        getInitialFocusTraversable in class Control
        Returns:
        the initial focus traversable state of this control
        Since:
        9