Interface StyleActions<PS,​S>

    • Method Detail

      • getUseInitialStyleForInsertion

        default boolean getUseInitialStyleForInsertion()
        Indicates whether the initial style should also be used for plain text inserted into this text area. When false, the style immediately preceding the insertion position is used. Default value is false.
      • setUseInitialStyleForInsertion

        default void setUseInitialStyleForInsertion​(boolean value)
        Sets the value of the property useInitialStyleForInsertion.
        Property description:
      • getInitialTextStyle

        S getInitialTextStyle()
        Style used by default when no other style is provided.
      • getInitialParagraphStyle

        PS getInitialParagraphStyle()
        Style used by default when no other style is provided.
      • isPreserveStyle

        boolean isPreserveStyle()
        Indicates whether style should be preserved on undo/redo (and in the future copy/paste and text move).
      • getStyleOfChar

        S getStyleOfChar​(int index)
        Returns the style of the character with the given index. If index points to a line terminator character, the last style used in the paragraph terminated by that line terminator is returned.
      • getStyleAtPosition

        S getStyleAtPosition​(int position)
        Returns the style at the given position. That is the style of the character immediately preceding position, except when position points to a paragraph boundary, in which case it is the style at the beginning of the latter paragraph.

        In other words, most of the time getStyleAtPosition(p) is equivalent to getStyleOfChar(p-1), except when p points to a paragraph boundary, in which case it is equivalent to getStyleOfChar(p).

      • getStyleRangeAtPosition

        javafx.scene.control.IndexRange getStyleRangeAtPosition​(int position)
        Returns the range of homogeneous style that includes the given position. If position points to a boundary between two styled ranges, then the range preceding position is returned. If position points to a boundary between two paragraphs, then the first styled range of the latter paragraph is returned.
      • getStyleSpans

        StyleSpans<S> getStyleSpans​(int from,
                                    int to)
        Returns the styles in the given character range.
      • getStyleSpans

        default StyleSpans<S> getStyleSpans​(javafx.scene.control.IndexRange range)
        Returns the styles in the given character range.
      • getStyleOfChar

        S getStyleOfChar​(int paragraph,
                         int index)
        Returns the style of the character with the given index in the given paragraph. If index is beyond the end of the paragraph, the style at the end of line is returned. If index is negative, it is the same as if it was 0.
      • getStyleAtPosition

        S getStyleAtPosition​(int paragraph,
                             int position)
        Returns the style at the given position in the given paragraph. This is equivalent to getStyleOfChar(paragraph, position-1).
      • getStyleRangeAtPosition

        javafx.scene.control.IndexRange getStyleRangeAtPosition​(int paragraph,
                                                                int position)
        Returns the range of homogeneous style that includes the given position in the given paragraph. If position points to a boundary between two styled ranges, then the range preceding position is returned.
      • getStyleSpans

        StyleSpans<S> getStyleSpans​(int paragraph)
        Returns styles of the whole paragraph.
      • getStyleSpans

        StyleSpans<S> getStyleSpans​(int paragraph,
                                    int from,
                                    int to)
        Returns the styles in the given character range of the given paragraph.
      • getStyleSpans

        default StyleSpans<S> getStyleSpans​(int paragraph,
                                            javafx.scene.control.IndexRange range)
        Returns the styles in the given character range of the given paragraph.
      • setStyle

        void setStyle​(int from,
                      int to,
                      S style)
        Sets style for the given character range.
      • setStyle

        void setStyle​(int paragraph,
                      S style)
        Sets style for the whole paragraph.
      • setStyle

        void setStyle​(int paragraph,
                      int from,
                      int to,
                      S style)
        Sets style for the given range relative in the given paragraph.
      • setStyleSpans

        void setStyleSpans​(int from,
                           StyleSpans<? extends S> styleSpans)
        Set multiple style ranges at once. This is equivalent to
         for(StyleSpan<S> span: styleSpans) {
             setStyle(from, from + span.getLength(), span.getStyle());
             from += span.getLength();
         }
         
        but the actual implementation in SimpleEditableStyledDocument is more efficient.
      • setStyleSpans

        void setStyleSpans​(int paragraph,
                           int from,
                           StyleSpans<? extends S> styleSpans)
        Set multiple style ranges of a paragraph at once. This is equivalent to
         for(StyleSpan<S> span: styleSpans) {
             setStyle(paragraph, from, from + span.getLength(), span.getStyle());
             from += span.getLength();
         }
         
        but the actual implementation in SimpleEditableStyledDocument is more efficient.
      • setParagraphStyle

        void setParagraphStyle​(int paragraph,
                               PS paragraphStyle)
        Sets style for the whole paragraph.
      • clearStyle

        default void clearStyle​(int from,
                                int to)
        Resets the style of the given range to the initial style.
      • clearStyle

        default void clearStyle​(int paragraph,
                                int from,
                                int to)
        Resets the style of the given range in the given paragraph to the initial style.
      • clearStyle

        default void clearStyle​(int paragraph)
        Resets the style of the given paragraph to the initial style.
      • clearParagraphStyle

        default void clearParagraphStyle​(int paragraph)
        Resets the style of the given paragraph to the initial style.