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
  • Property Details

  • Constructor Details

    • 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 Details

    • setOrientation

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

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

      public final ObjectProperty<Orientation> orientationProperty()
      The orientation of the Separator can either be horizontal or vertical.
      Returns:
      the orientation property
      See Also:
    • setHalignment

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

      public final HPos getHalignment()
      Gets the value of the halignment property.
      Property description:
      For vertical separators, specifies the horizontal position of the separator line within the separator control's space. Ignored for horizontal separators.
      Returns:
      the value of the halignment property
      See Also:
    • 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.
      Returns:
      the halignment property
      See Also:
    • setValignment

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

      public final VPos getValignment()
      Gets the value of the valignment property.
      Property description:
      For horizontal separators, specifies the vertical alignment of the separator line within the separator control's space. Ignored for vertical separators.
      Returns:
      the value of the valignment property
      See Also:
    • 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.
      Returns:
      the valignment property
      See Also:
    • getClassCssMetaData

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

      protected List<CssMetaData<? extends Styleable,?>> getControlCssMetaData()
      Gets the unmodifiable list of the control's CSS-styleable properties.
      Overrides:
      getControlCssMetaData in class Control
      Returns:
      the unmodifiable list of the control's 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. 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