java.lang.Object
io.github.sosuisen.jfxbuilder.controls.MenuBarSkinBuilder

public class MenuBarSkinBuilder extends Object
The MenuBarSkinBuilder class constructs instances of the MenuBarSkin class and offers a fluent interface for creating and configuring it.

This class includes a static create method that accepts the same arguments as the original MenuBarSkin constructor and returns an instance of the MenuBarSkinBuilder.

You can use method chaining to call the builder methods for configuring the MenuBarSkin. Finally, invoke the build method to generate an instance of the MenuBarSkin class.

Note that intermediate builder methods are not evaluated until the build method is called, meaning they are evaluated lazily.

Author:
Hidekazu Kubota <hidekazu.kubota@gmail.com>
  • Method Details

    • create

      public static MenuBarSkinBuilder create(MenuBar control)
      Accepts the constructor arguments of MenuBarSkin(MenuBar) and returns an instance of MenuBarSkinBuilder.
      Returns:
      an instance of the MenuBarSkinBuilder.
    • build

      public MenuBarSkin build()
      Builds and returns an instance of the MenuBarSkin class.

      Intermediate builder methods are not evaluated until the build method is called; in other words, they are evaluated lazily.

      Returns:
      new instance of the MenuBarSkin class
    • apply

      public MenuBarSkinBuilder apply(Consumer<MenuBarSkin> func)
      Applies a function to the MenuBarSkin instance being constructed. Most operations on the instance can be performed using this method.
      Returns:
      builder instance
    • containerAlignment

      public MenuBarSkinBuilder containerAlignment(Pos value)
      A builder method that invokes the setContainerAlignment method on the instance being constructed.
      Returns:
      builder instance
    • spacing

      public MenuBarSkinBuilder spacing(double value)
      A builder method that invokes the setSpacing method on the instance being constructed.
      Returns:
      builder instance
    • addChildren

      public final MenuBarSkinBuilder addChildren(Node... elements)
      Calls the addAll method on the ObservableList returned by the MenuBarSkin#getChildren() method.
      Returns:
      builder instance
    • addChildren

      public final MenuBarSkinBuilder addChildren(Collection<? extends Node> col)
      Calls the addAll method on the ObservableList returned by the MenuBarSkin#getChildren() method.
      Returns:
      builder instance
    • containerAlignmentPropertyApply

      public MenuBarSkinBuilder containerAlignmentPropertyApply(Consumer<ObjectProperty<Pos>> op)
      Applies a function to the containerAlignmentProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.containerAlignmentProperty().bind(anotherProperty))
      
      // Use shorthand form
      .containerAlignmentPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • spacingPropertyApply

      public MenuBarSkinBuilder spacingPropertyApply(Consumer<DoubleProperty> op)
      Applies a function to the spacingProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.spacingProperty().bind(anotherProperty))
      
      // Use shorthand form
      .spacingPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance