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 |
Merges the specified attributes with the attributes in this instance. |
<V> StyleAttributeMap.Builder |
set |
Sets the value for the specified attribute. |
StyleAttributeMap.Builder |
setBackground |
Sets the paragraph background attribute to the specified color. |
StyleAttributeMap.Builder |
setBold |
Sets the bold attribute. |
StyleAttributeMap.Builder |
setBullet |
Sets the BULLET attribute. |
StyleAttributeMap.Builder |
setFirstLineIndent |
Sets the FIRST_LINE_INDENT attribute. |
StyleAttributeMap.Builder |
setFontFamily |
Sets the font family attribute. |
StyleAttributeMap.Builder |
setFontSize |
Sets the font size attribute. |
StyleAttributeMap.Builder |
setItalic |
Sets the italic attribute. |
StyleAttributeMap.Builder |
setLineSpacing |
Sets the line spacing paragraph attribute. |
StyleAttributeMap.Builder |
setRTL |
Sets the paragraph direction attribute. |
StyleAttributeMap.Builder |
setSpaceAbove |
Sets the space above paragraph attribute. |
StyleAttributeMap.Builder |
setSpaceBelow |
Sets the space below paragraph attribute. |
StyleAttributeMap.Builder |
setSpaceLeft |
Sets the space left paragraph attribute. |
StyleAttributeMap.Builder |
setSpaceRight |
Sets the space right paragraph attribute. |
StyleAttributeMap.Builder |
setStrikeThrough |
Sets the strike-through attribute. |
StyleAttributeMap.Builder |
setTextAlignment |
Sets the text alignment attribute to the specified color. |
StyleAttributeMap.Builder |
setTextColor |
Sets the text color attribute to the specified color. |
StyleAttributeMap.Builder |
setUnderline |
Sets the underline attribute. |
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
setRTL
public StyleAttributeMap.Builder setRTL(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
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
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.