StyleAttributeMap.Builder (JavaFX 27)
Description: declaration: module: jfx.incubator.richtext, package: jfx.incubator.scene.control.richtext.model, class: StyleAttributeMap, class: Builder

# Class StyleAttributeMap.Builder

java.lang.Object
jfx.incubator.scene.control.richtext.model.StyleAttributeMap.Builder

Enclosing class:
  `StyleAttributeMap`

public static class StyleAttributeMap.Builder extends Object
StyleAttributeMap are immutable, so a Builder is required to create a new instance

Since:
  24

- ## Method Summary

  Modifier and Type
  Method
  Description
  `StyleAttributeMap`
  `build()`
  Creates an immutable instance of `StyleAttributeMap` with the attributes set by this Builder.
  `StyleAttributeMap.Builder`
  `merge(StyleAttributeMap attrs)`
  Merges the specified attributes with the attributes in this instance.
  `<V> StyleAttributeMap.Builder`
  `set(StyleAttribute<V> a, V value)`
  Sets the value for the specified attribute.
  `StyleAttributeMap.Builder`
  `setBackground(Color color)`
  Sets the paragraph background attribute to the specified color.
  `StyleAttributeMap.Builder`
  `setBold(boolean on)`
  Sets the bold attribute.
  `StyleAttributeMap.Builder`
  `setBullet(String bullet)`
  Sets the BULLET attribute.
  `StyleAttributeMap.Builder`
  `setFirstLineIndent(double size)`
  Sets the FIRST_LINE_INDENT attribute.
  `StyleAttributeMap.Builder`
  `setFontFamily(String name)`
  Sets the font family attribute.
  `StyleAttributeMap.Builder`
  `setFontSize(double size)`
  Sets the font size attribute.
  `StyleAttributeMap.Builder`
  `setItalic(boolean on)`
  Sets the italic attribute.
  `StyleAttributeMap.Builder`
  `setLineSpacing(double value)`
  Sets the line spacing paragraph attribute.
  `StyleAttributeMap.Builder`
  `setParagraphDirection(ParagraphDirection d)`
  Sets the paragraph direction attribute.
  `StyleAttributeMap.Builder`
  `setSpaceAbove(double value)`
  Sets the space above paragraph attribute.
  `StyleAttributeMap.Builder`
  `setSpaceBelow(double value)`
  Sets the space below paragraph attribute.
  `StyleAttributeMap.Builder`
  `setSpaceLeft(double value)`
  Sets the space left paragraph attribute.
  `StyleAttributeMap.Builder`
  `setSpaceRight(double value)`
  Sets the space right paragraph attribute.
  `StyleAttributeMap.Builder`
  `setStrikeThrough(boolean on)`
  Sets the strike-through attribute.
  `StyleAttributeMap.Builder`
  `setTabStops(double... positions)`
  Sets the tab stops paragraph attribute.
  `StyleAttributeMap.Builder`
  `setTextAlignment(TextAlignment a)`
  Sets the text alignment attribute to the specified color.
  `StyleAttributeMap.Builder`
  `setTextColor(Color color)`
  Sets the text color attribute to the specified color.
  `StyleAttributeMap.Builder`
  `setUnderline(boolean on)`
  Sets the underline attribute.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### build

    public StyleAttributeMap build()
    Creates an immutable instance of `StyleAttributeMap` with the attributes set by this Builder.
    Returns:
      the new instance

  - ### set

    public <V> StyleAttributeMap.Builder set(StyleAttribute<V> a, V value)
    Sets the value for the specified attribute. This method will throw an `IllegalArgumentException` if the value cannot be cast to the type specified by the attribute.
    Type Parameters:
      `V` - the attribute value type
    Parameters:
      `a` - the attribute
      `value` - the attribute value
    Returns:
      this Builder instance

  - ### merge

    public StyleAttributeMap.Builder merge(StyleAttributeMap attrs)
    Merges the specified attributes with the attributes in this instance. The new values override any existing ones.
    Parameters:
      `attrs` - the attributes to merge, may be null
    Returns:
      this Builder instance

  - ### setBackground

    public StyleAttributeMap.Builder setBackground(Color color)
    Sets the paragraph background attribute to the specified color. It is recommended to specify a translucent background color in order to avoid obstructing the selection and the current line highlights.
    Parameters:
      `color` - the color
    Returns:
      this Builder instance

  - ### setBold

    public StyleAttributeMap.Builder setBold(boolean on)
    Sets the bold attribute.
    Parameters:
      `on` - true for bold typeface
    Returns:
      this Builder instance

  - ### setBullet

    public StyleAttributeMap.Builder setBullet(String bullet)
    Sets the BULLET attribute.
    Parameters:
      `bullet` - the bullet character
    Returns:
      this Builder instance

  - ### setFirstLineIndent

    public StyleAttributeMap.Builder setFirstLineIndent(double size)
    Sets the FIRST_LINE_INDENT attribute.
    Parameters:
      `size` - the first line indent value
    Returns:
      this Builder instance

  - ### setFontFamily

    public StyleAttributeMap.Builder setFontFamily(String name)
    Sets the font family attribute.
    Parameters:
      `name` - the font family name
    Returns:
      this Builder instance

  - ### setFontSize

    public StyleAttributeMap.Builder setFontSize(double size)
    Sets the font size attribute.
    Parameters:
      `size` - the font size in points
    Returns:
      this Builder instance

  - ### setLineSpacing

    public StyleAttributeMap.Builder setLineSpacing(double value)
    Sets the line spacing paragraph attribute.
    Parameters:
      `value` - the line spacing value
    Returns:
      this Builder instance

  - ### setItalic

    public StyleAttributeMap.Builder setItalic(boolean on)
    Sets the italic attribute.
    Parameters:
      `on` - true for italic typeface
    Returns:
      this Builder instance

  - ### setParagraphDirection

    public StyleAttributeMap.Builder setParagraphDirection(ParagraphDirection d)
    Sets the paragraph direction attribute.
    Parameters:
      `d` - the paragraph direction
    Returns:
      this Builder instance

  - ### setSpaceAbove

    public StyleAttributeMap.Builder setSpaceAbove(double value)
    Sets the space above paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.
    Parameters:
      `value` - the space amount
    Returns:
      this Builder instance

  - ### setSpaceBelow

    public StyleAttributeMap.Builder setSpaceBelow(double value)
    Sets the space below paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.
    Parameters:
      `value` - the space amount
    Returns:
      this Builder instance

  - ### setSpaceLeft

    public StyleAttributeMap.Builder setSpaceLeft(double value)
    Sets the space left paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.
    Parameters:
      `value` - the space amount
    Returns:
      this Builder instance

  - ### setSpaceRight

    public StyleAttributeMap.Builder setSpaceRight(double value)
    Sets the space right paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.
    Parameters:
      `value` - the space amount
    Returns:
      this Builder instance

  - ### setStrikeThrough

    public StyleAttributeMap.Builder setStrikeThrough(boolean on)
    Sets the strike-through attribute.
    Parameters:
      `on` - true for strike-through typeface
    Returns:
      this Builder instance

  - ### setTabStops

    public StyleAttributeMap.Builder setTabStops(double... positions)
    Sets the tab stops paragraph attribute.
    Parameters:
      `positions` - the tab stop positions
    Returns:
      this Builder instance
    Since:
      27

  - ### setTextAlignment

    public StyleAttributeMap.Builder setTextAlignment(TextAlignment a)
    Sets the text alignment attribute to the specified color.
    Parameters:
      `a` - the alignment
    Returns:
      this Builder instance

  - ### setTextColor

    public StyleAttributeMap.Builder setTextColor(Color color)
    Sets the text color attribute to the specified color.
    Parameters:
      `color` - the color
    Returns:
      this Builder instance

  - ### setUnderline

    public StyleAttributeMap.Builder setUnderline(boolean on)
    Sets the underline attribute.
    Parameters:
      `on` - true for underline
    Returns:
      this Builder instance