Class WrappedText

  • All Implemented Interfaces:
    Serializable

    public final class WrappedText
    extends Object
    implements Serializable
    Represents a piece of text that has been wrapped into lines.

    This class is immutable and thread-safe.

    Since:
    8.4.0
    See Also:
    Serialized Form
    • Constructor Detail

      • WrappedText

        public WrappedText​(List<WrappedLine> lines,
                           double width,
                           double height)
        Creates a new wrapped text.
        Parameters:
        lines - The lines of the wrapped text.
        width - The width of the entire piece of text.
        height - The height of the entire piece of text.
    • Method Detail

      • height

        public double height()
        Gets the height of the entire piece of text.
        Returns:
        The height of the text.
      • lines

        public List<WrappedLine> lines()
        Gets the individual lines that make up the wrapped text.
        Returns:
        The lines of the wrapped text.
      • text

        public String text​(Newline newline)
        Returns the entire text with all lines separated by the given newline.
        Parameters:
        newline - Newline to use for separating the lines.
        Returns:
        All lines joined with the given newline.
      • text

        public String text()
        Returns the entire text with all lines separated by a single space when not a forced line break, or LF when a forced line break is present.
        Returns:
        All lines joined with a single space or LF.
      • width

        public double width()
        Gets the width of the entire piece of text.
        Returns:
        The width of the text.