On Fri, 7 Nov 2025 20:08:15 GMT, Andy Goryachev <[email protected]> wrote:

> Addressing the user feedback:
> 
> In RichParagraph you have a note to make getSegments() public.  It would be 
> helpful if it was.
> 
> 
> Adding two methods to the `RichParagraph` class:
> 
> - getSegmentCount()
> - getSegment(int index)
> 
> Decided against exposing a List since it would require additional allocation. 
>  Some of the callers seems to implement special logic when the number of 
> segments is 0 anyway.

modules/jfx.incubator.richtext/src/main/java/jfx/incubator/scene/control/richtext/model/RichParagraph.java
 line 133:

> 131:      * @since 26
> 132:      */
> 133:     public abstract StyledSegment getSegment(int index);

A `List<StyledSegment> getSegments()` method would be more convenient to use. 
You could either return an unmodifiable view of the list or make a shallow copy.

What is the reason for separate `getSegmentCount` and `getSegment(index)` 
methods?

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1966#discussion_r2505672434

Reply via email to