StyledText.setStyleRanges

Clears the styles in the range specified by <code>start</code> and <code>length</code> and adds the new styles. <p> The ranges array contains start and length pairs. Each pair refers to the corresponding style in the styles array. For example, the pair that starts at rangesn with length ranges[n+1] uses the style at styles[n/2]. The range fields within each StyleRange are ignored. If ranges or styles is null, the specified range is cleared. </p><p> Note: It is expected that the same instance of a StyleRange will occur multiple times within the styles array, reducing memory usage. </p><p> Should not be called if a LineStyleListener has been set since the listener maintains the styles. </p>

@param start offset of first character where styles will be deleted @param length length of the range to delete styles in @param ranges the array of ranges. The ranges must not overlap and must be in order. @param styles the array of StyleRanges. The range fields within the StyleRange are unused.

@exception SWTException <ul> <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> </ul> @exception IllegalArgumentException <ul> <li>ERROR_NULL_ARGUMENT when an element in the styles array is null</li> <li>ERROR_INVALID_RANGE when the number of ranges and style do not match (ranges.length * 2 is styles.length)</li> <li>ERROR_INVALID_RANGE when a range is outside the valid range (> getCharCount() or less than zero)</li> <li>ERROR_INVALID_RANGE when a range overlaps</li> </ul>

@since 3.2

  1. void setStyleRanges(int start, int length, int[] ranges, StyleRange[] styles)
    class StyledText
    void
    setStyleRanges
    ()
  2. void setStyleRanges(int[] ranges, StyleRange[] styles)
  3. void setStyleRanges(StyleRange[] ranges)

Meta