Class Separator

java.lang.Object
limn.scene.Widget
limn.components.Separator

public final class Separator extends Widget
A thin divider line drawn in the theme's Theme.outline color. A horizontal separator stretches across the available width (with a thin height); a vertical one stretches down the available height (thin width). Use it to divide groups in a Column/Row or inside a ToolBar.

Size axis

Separator participates by inheritance only and exposes no size setter: what a reader perceives is a 1 pt hairline, pixel-locked at every ControlSize step. Only the box around the line moves. A "large separator" is either the same line with more air (the container's job) or a thicker rule, which is a different visual element.

The box is odd at every step on purpose: a 1 pt line can only sit exactly centred inside an odd box, and the snap relies on that parity. setInset(float) is the one dimension a caller controls.

  • Method Details

    • horizontal

      public static Separator horizontal()
      A rule stretching across the available width.
    • vertical

      public static Separator vertical()
      A rule stretching down the available height.
    • setInset

      public Separator setInset(float margin)
      Trims margin points off both ends of the line.
    • onMeasure

      protected Size onMeasure(Constraints constraints)
      Description copied from class: Widget
      Reports the size this widget wants within constraints. Called once per layout pass, and the result is cached against the constraints and the resolved axes (size step, layout direction, locale), so it must be a pure function of them and of this widget's own state.

      Resolve the ControlSize and the LayoutDirection once each here and thread them down; never read either in a constructor. The locale needs no threading: it is in scope, and I18n.locale() answers it wherever text is resolved.

      Specified by:
      onMeasure in class Widget
    • onPaint

      protected void onPaint(Canvas canvas)
      Description copied from class: Widget
      Widget's own background/content, in local coordinates.
      Overrides:
      onPaint in class Widget